• Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey

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!

Setting output for SPSS Variable names, Labels, or both

SPSS variable

Typically I want to have the SPSS variable labels show up in my SPSS output however there are times when having the variable names is beneficial (especially for writing more syntax).  Other times (rare) I actually want to have both.  The syntax for changing is straight forward

 
*****Show Names*********.
SET OVars Labels ONumbers Labels TVars Names TNumbers Labels.

*****Show Labels********.
SET OVars Labels ONumbers Labels TVars Labels TNumbers Labels.

*****Show Both**********.
SET OVars Labels ONumbers Labels TVars Both TNumbers Labels.

video demonstrating using the syntax on the SPSS Variable Names

  • Intro to AutoHotkey HotStrings with AutoHotkey Intermediate AutoHotkey GUIs are Easy with AutoHotkey Intro to DOS & AutoHotkey