Showing posts with label Datetimes. Show all posts
Showing posts with label Datetimes. Show all posts

Monday, July 4, 2022

SAS Date Calculator Now Available


SAS Date Calculator*
Date:

Days since 1/1/1960:

SAS Datetime Calculator*
Datetime:

Seconds since midnight 1/1/1960:


*For valid results, SAS date value must be between 1582 CE and 20,000 CE on the Gregorian Calendar. Note that American Colonies and Great Britain did not adopt the Gregorian Calendar until 1752.

To use the SAS Date Calculator/Converter, enter a date value in the first text box. 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.

The SAS Datetime Calculator works similarly but calculates Datetimes.


To convert dates and datetimes in SAS, use code like this:

/*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;

To convert a date in Excel, subtract 21,916:
To convert a datetime in Excel, subtract 21,916, then multiply by 86,400:

Tuesday, June 17, 2014

Free SAS Date Calculator

SAS Date Calculator*
Date:

Days since 1/1/1960:


*For valid results, SAS date value must be between 1582 CE and 20,000 CE on the Gregorian Calendar. Note that American Colonies and Great Britain did not adopt the Gregorian Calendar until 1752.

To convert a date in Excel, subtract 21,916:

Free SAS Datetime Calculator

SAS Datetime Calculator*
Datetime:

Seconds since midnight 1/1/1960:


*For valid results, SAS date value must be between 1582 CE and 20,000 CE on the Gregorian Calendar. Note that American Colonies and Great Britain did not adopt the Gregorian Calendar until 1752.

To convert a datetime in Excel, subtract 21,916 and multiply by 86,400: