Dates and Times: SAS Date, Time and Date-Time Formats
Dates and Times: SAS Date, Time and Date-Time Formats
Date Storage
SAS stores Dates, Times and Date-Time values
differently.
Datetime: seconds between January 1,
1960 and an hour/minute/second within a
specified date
Time: seconds since midnight of the
current day
Date: days between January 1, 1960, and a
specified date
Functions
Functions that extract dates and times
from datetime variables
DATEPART(variable): extracts the
date from a SAS datetime value
TIMEPART(variable): extracts the
time from a SAS datetime value
HMS(hour,minute,second)
hrid=hms(12,45,10);
Examples
Character to numeric
Sale= INPUT(2,115,353,comma9.)
Converting to character
Data Test;
dateval= put(123456,mmddyy8.);
put dateval;
run;
Produces 01/04/98 in the SAS log