A UNIX datetime value
is stored as the number of seconds since January 1, 1970. A SAS datetime
value is stored as the number of seconds since January 1, 1960. To
convert a UNIX datetime value to a SAS datetime value, you must add
10 years in seconds to the UNIX datetime value.
The INTNX function converts
a UNIX datetime value to a SAS datetime value, as shown in the example
below:
data UNIX_to_SAS;
input UNIX_datetime;
/* The INTNX function accounts for leap years. */
SAS_datetime = intnx('DTyear',UNIX_datetime,10,'s');
format SAS_datetime datetime20.;
datalines;
1285560000
1313518500
1328414200
;
proc print data=UNIX_to_SAS;
run;
The following output
displays the results.
Conversion of a UNIX Datetime Value to a SAS Datetime Value
For more information,
see INTNX Function in SAS Functions and CALL Routines: Reference.