For time calculations (such as the number of days between two dates) proper date variables are needed. In some cases, the digits of a numeric variable may represent year, month and day. This tutorial shows how to convert this format into an actual date variable.
Read more...
THIS TUTORIAL HAS 3 COMMENTS:
By Amy on June 20th, 2018
14th October 1582 is the exact timepoint that SPSS uses to calculate it's date in seconds from. Just in case anyone wants to recode a date variable using syntax. You will need this date.
By Ruben Geert van den Berg on June 20th, 2018
Hi Amy!
If you'd like to RECODE a date variable, you could do so by recoding the underlying numbers which you'll see after running something like
FORMATS mydate(f16).
However, the more likely solution for this is using DATE.DMY combined with IF as in
IF(mydate > DATE.DMY(1,1,2018)) outputvariable = ....
For recoding date ranges, try IF with RANGE with DATE.DMY.
Hope that helps!
By Amy on July 3rd, 2018
Thanks Ruben! Helpful stuff - you really are a bit of an SPSS guru ;)