To begin with, I understand the basics of 1/1/1960 as the 'base' for all dates in SAS programming, so no need to elaborate on that.
What I don't understand is what my code is doing to change the dates back to that date from what I'm trying to input. Any guidance you may provide is greatly apprecated.
DATA study; SET chart;
IF Sequence_No_ = 'A01-02' THEN DO;
Best = 2; Best_Date = 09/11/2017; Prog_Date = 09/11/2017;
END;
ELSE IF Sequence_No_ = 'A01-03' THEN DO;
Best = 2; Best_Date = 11/28/2017; Prog_Date = 11/28/2017; END;
FORMAT Best_Date MMDDYY.10 Prog_Date MMDDYY10.
RUN;
What I get back is:
Sequence_No Best_Date Prog_Date
A01-02 01-01-1960 01-01-1960
A01-03 01-01-1960 01-01-1960
Again, I get the significance of 1-1-1960. All I need is the correct code so that I get the dates I want. Thanks!
Best_Date = 09/11/2017;
You do not assign a date here, but the result of a numeric expression: 9 divided by 11, then divided by 2017. This gives a very small number close to zero, which, when formatted as a date, will result in 1960-01-01.
To supply dates in code, you must use valid date literals:
Best_Date = "09nov2017"d;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.