Date Variables

In SPSS, a date is the number of seconds since the year 1582. These are huge numbers but they are still just numbers like somebody’s weight in kilos or the number of cars in some household. The main difference between dates and other variables is that SPSS displays dates with slashes or dots as in “2016/11/07”. Once you fully realize […]

Remove Value Label from Multiple Variables

Question “I’d like to completely remove the value label from a value for many variables at once. Is there an easy way to accomplish that?” SPSS Python Syntax Example begin program. variables = ‘v1 to v5‘ # Specify variables here. value = 3 # Specify value to unlabel here. import spss,spssaux vDict = spssaux.VariableDict(caseless = True) varList […]

SPSS – Splitting a String Variable

After importing some data into SPSS, some answers ended up in a single string variable. The data are in splitstrings.sav, part of which is shown below. Excel has a nice “text to columns” function to split it but SPSS hasn’t…So you think you can syntax?Then let’s go and split this string into the original answers. Step 1 – New […]

Suffix All Variable Names

Question “I have a data file in which all variables were measured in 2012. I’d like to suffix their names with “_2012”. What’s the easiest way to do this?” SPSS Python Syntax Example begin program. variables = ‘v5 to v10‘ #Specify variables to be suffixed. suffix =’_2012‘ # Specify suffix. import spss,spssaux oldnames = spssaux.VariableDict().expand(variables) […]

SPSS FORMATS – Set Display Format for Variables

SPSS FORMATS sets formats -decimal places, dates, percent signs and more- for numeric variables. Setting variable formats in SPSS does not change your actual data values. However, formats determine how your data are displayed -in the data viewer as well as the output-window. Two main uses of FORMATS are increasing or decreasing the decimal places of standard numeric variables; displaying date, time and datetime values (consisting […]

SPSS – Set Variable Labels with Syntax

Managing variable and value labels without syntax is way more work than necessary. This tutorial explains how to do this more efficiently. Changing Variable Labels in SPSS As with other parts of the dictionary, there’s no “Paste” option for modifying variable labels. Be aware that manual modifications – apart from being time consuming – are not […]