Tips & Tricks #23 – before a specific date

 In Tips & Tricks

There were a user who told about a smart command he uses a lot, and I would like to share this tip with you.  Say that you want to flag all cases that has a date before 23 Oct 2018.

To let SPSS understand you, you have to work with the date formats.

So here is the example of the data file:

 

So in this example I would like to select all people that visited an event before the 23 of Oct 2018, and use the “Compute” command for that and use this date-function :

date<DATE.DMY(23,10,2018)

So have a look on the Picture below. First you create a new variable name here: “Before23Oct”  and then create a value (here 1) for everyone that has a date Before 23 Oct. Then you have to click the if-button in the left bottom corner so you can put in the selection of : “date<DATE.DMY(23,10,2018)

Then click OK and the result will be following:

 

You can then recoce each missing value to 0 in the “Recode into same variable”- command and recode all sysmis to 0.

Thanks for watching this!

Gunilla

error: Content is protected !!