mardi 28 février 2017

SAS: How can you write an IF statement to categorize data before a certain date and after it

I have a table with a column named DATE1 with format YYYY-MM-DD, and I need to create another column to categorize data into two groups. How should I write the code? I think that the problem is with the date format, the syntax should change.

    Data Tabla1;
    set &tTable0; 

    if DATE1 < 2001-12-31 THEN DATE1_AUX = "<2001"; else
   DATE1_AUX = >2001;

    keep    Date1
            DATE1_AUX;

    run;

Aucun commentaire:

Enregistrer un commentaire