We have added an online, interactive SAS Date Calculator and Converter. It is available for free in this post (above). To use it, enter a date value in the first text box, and the unformatted date value (i.e., the number of days since 1/1/1960) that SAS associates with that number will appear in the second text box. The calculator also works in reverse.
We have also added a SAS Datetime Calculator and Converter, also available for free in this post (above). It works in the same way as the date calculator, except it calculates Datetimes.
It is also possible to run such conversions within SAS. Example code:
/*print date formatted as number*/
DATA _NULL_;
d = INPUT('21DEC11'd, best12.);
PUT d;
RUN;
/*print number formatted as date*/
DATA _NULL_;
d = 18982;
FORMAT d date9.;
PUT d;
RUN;
/*print datetime formatted as number*/
DATA _NULL_;
dt = INPUT('21DEC11 12:00:35'dt, best12.);
PUT dt;
RUN;
/*print number formatted as datetime*/
DATA _NULL_;
dt = 1640088035;
FORMAT dt datetime.;
PUT dt;
RUN;