Thursday 4 June 2009

System Variables

Following are the three main System Variables:

$jdate

This variable gives the current date as the number of days from October 14, 1582.

Example:
COMPUTE today = $jdate.
exe.

$sysmis
This can be used when you want to specify that a newly created variable (or some of its values) should be set to system missing.

Example:
compute miss = $sysmis.
compute miss1 = 1.
if missing(q1) or missing(q3) miss1 = $sysmis.

$casenum
You can use this variable if you want to create an id variable that is part of your data set.

Example:
compute id = $casenum.
exe.

Source: http://www.ats.ucla.edu/stat/spss/seminars/spss_syntax/default.htm