Configure your SPSS variable format properly using syntax

SPSS variable

SPSS Variable Formats

If you’re you want to have pretty-looking tables / output, having your data in the proper format really helps.  (not to mention that SPSS is “smart” and will prevent showing them in some GUI procedures if your variable is the “wrong” type.)

While the GUI window to the data editor makes it easy to adjust the variable level, format, type,etc.  I had a hard time finding the correct syntax to set them programatically.

This video helps with some of the more-common settings.  Below is the syntax for tweaking SPSS variable level and format.

 
************CHANGE DATA LEVEL******************* .
VARIABLE LEVEL var1 var2 (Nominal).
VARIABLE LEVEL var1 var2 (Ordinal).
VARIABLE LEVEL var1 var2 (Scale).

************FORMAT VARIABLE******************* .
****Numeric with TWO decimal places**************************.
FORMAT var1 var2 (F5.2).

****Numeric with ZERO decimal places**************************.
FORMAT var1 var2 (F5.0).

****Comma with ZERO decimal places**************************.
FORMAT var1 var2 (COMMA4.0).

****Dollar with TWO decimal places**************************.
FORMAT var1 var2 (DOLLAR6.2).

****Percents with ONE decimal place**************************.
FORMAT var1 var2 (PCT4.1).

 

Check out my post on setting SPSS variables for missing data!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.