May I know how to get the "Today Datetime" in current datetime instead of 1960? Thanks.
data _null_;
x=today();
y=x;z=x;
format y date9.;format z datetime20.;
put "Unformatted:" x "Formatted:" y "Today Datetime:" z;run;
data _null_; x = today(); format x ddmmyy10.; y = datetime(); format y datetime20.; put "Formatted day: " x " , formatted datetime: " y; run;
View solution in original post
today() delivers a date, which is the count of days from 1960-01-01.
A datetime format expects a count of seconds from 1960-01-01T00:00:00.
That's why you get a timestamp from 1960-01-01.
Either use the datetime() function, or a date format.
April 27 - 30 | GAYLORD TEXAN
Register now to lock in early bird pricing through February 25!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.