Dates From Datetimes

Sunday, 28 October, 2012

⨳ 1 minute read ⨳ 64 words ⨳ date valuesfunctionsastechnical debt

Browsing online to find examples of creating a JSON file from a SAS data set I came across a monstrosity for extracting a date value from a date time value.

end_dt=input(substr(put(s_end_dt,datetime20.),3,9),date9.);

I cringed and made a sound befitting of a good Halloween costume. Here’s my typical approach for this:

end_dt=datepart(s_end_dt);

Either way, I guess.


Dates From Datetimes - October 28, 2012 - Richard Koopmann