In reply to Andrew Howell.

Hi Andrew & Chris,

I do not think you can use INTNX in this case. It will cause a difference of -1 day depending on the number of leap days in the years between the Unix date and the SAS date.

The following example shows the difference:

data UNIX_to_SAS;
input UNIX_datetime;
/* The INTNX function accounts for leap years. */
SAS_datetime = intnx('DTyear',UNIX_datetime,10,'s');
SAS_datetime2 = UNIX_datetime + 315619200;
SAS_datetime3 = dhms('01jan1970'd, 0, 0, UNIX_datetime);
format SAS_datetime SAS_datetime2 SAS_datetime3 datetime20.;
datalines;
1285560000
1313518500
1328414200
;
proc print data=UNIX_to_SAS;
run;

Jasper