Variable attributes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable attributes

Researcher-4
Hello
What is the difference between the width attribute and the columns attribute?
Reply | Threaded
Open this post in threaded view
|

Re: Variable attributes

Daniel Robertson
Hello Researcher,

In the variable view of the Data Editor, the COLUMNS attribute refers to
the column width for display of variables the data view -- e.g., how
wide the column is in the data view. It has no relationship to the
variable definition, which is set using the WIDTH attribute in the data
editor.

Confusingly, the way you change the displayed width of the column using
Syntax is the VARIABLE WIDTH command: e.g.,
    VARIABLE WIDTH FOOBAR (20)
has the same effect as clicking in the COLUMNS box for the variable
FOOBAR and typing "20".

The WIDTH attribute in the data editor refers to the print/write format
of the variable. Using Syntax, this is changed for a numeric variable
using the FORMATS command: e.g.,
    FORMATS FOOBAR (F5.4)
has the same effect as typing "5" in the WIDTH box and "4" in the
DECIMALS box. (I believe changing the format of a string variable
requires actually computing a new variable).

Print and Write Formats can be set separately using PRINT FORMATS and
WRITE FORMATS respectively, but making a change in the Variable View
window changes both.

And, the way a numeric variable is stored internally by SPSS by doesn't
have anything to do with how the variable is displayed: "Numeric values
are stored internally as double-precision floating-point numbers."

Hope this helps,

Dan R.

Researcher wrote:
> Hello
> What is the difference between the width attribute and the columns attribute?
>
>

--
Daniel Robertson
Senior Research and Planning Associate
Institutional Research and Planning
Cornell University, Ithaca NY 14853-2801
607.255.9642 / irp.cornell.edu
Reply | Threaded
Open this post in threaded view
|

Re: Variable attributes

Daniel Robertson
The WIDTH attribute in the variable view allows you to change the 1)
Print and 2) Write Format of a numeric variable -- that is, how the
variable is 1) displayed in the data editor and in output, and 2)
formatted when written to a new file using the WRITE command.

Information on both formats is stored in the Data Dictionary -- use a
"DISPLAY DICTIONARY" command or select "Display Data File Information"
from the File menu. Print Format just sets the way the variable is
displayed in the data editor and in SPSS output (e.g, as a dollar, date,
with or without commas, how many decimal points). And changing the Write
Format may be necessary if you are using the WRITE command to output a
text file in a special format -- otherwise you'll probably rarely need
to worry about changing the Write Format from the default.

Hope this helps,
Dan R.


Researcher wrote:

> Can you please elaborate on the role of the WIDTH attribute in the
> definition of the variable.? Thank you
> ----- Original Message ----- From: "Daniel Robertson" <[hidden email]>
> To: <[hidden email]>
> Sent: Wednesday, May 09, 2007 4:38 PM
> Subject: Re: Variable attributes
>
>
>> Hello Researcher,
>>
>> In the variable view of the Data Editor, the COLUMNS attribute refers to
>> the column width for display of variables the data view -- e.g., how
>> wide the column is in the data view. It has no relationship to the
>> variable definition, which is set using the WIDTH attribute in the data
>> editor.
>>
>> Confusingly, the way you change the displayed width of the column using
>> Syntax is the VARIABLE WIDTH command: e.g.,
>>    VARIABLE WIDTH FOOBAR (20)
>> has the same effect as clicking in the COLUMNS box for the variable
>> FOOBAR and typing "20".
>>
>> The WIDTH attribute in the data editor refers to the print/write format
>> of the variable. Using Syntax, this is changed for a numeric variable
>> using the FORMATS command: e.g.,
>>    FORMATS FOOBAR (F5.4)
>> has the same effect as typing "5" in the WIDTH box and "4" in the
>> DECIMALS box. (I believe changing the format of a string variable
>> requires actually computing a new variable).
>>
>> Print and Write Formats can be set separately using PRINT FORMATS and
>> WRITE FORMATS respectively, but making a change in the Variable View
>> window changes both.
>>
>> And, the way a numeric variable is stored internally by SPSS by doesn't
>> have anything to do with how the variable is displayed: "Numeric values
>> are stored internally as double-precision floating-point numbers."
>>
>> Hope this helps,
>>
>> Dan R.
>>
>> Researcher wrote:
>>> Hello
>>> What is the difference between the width attribute and the columns
>>> attribute?
>>>
>>>
>>
>>
>
>
>

--
Daniel Robertson
Senior Research and Planning Associate
Institutional Research and Planning
Cornell University, Ithaca NY 14853-2801
607.255.9642 / irp.cornell.edu