/********************************************************************* Goal: Both SAS and C store datetimes as the number of seconds since some date. Unfortunately, we use different starting dates. SAS uses 01Jan1960 and C uses 01Jan1970 as the starting date. The goal is to convert C datetime values to SAS datetime values. Strategy: Find the offset, using a datetime constant, and use this offset to make the conversion. Documentation: "SAS Language, Reference, Version 6, First Edition", pages 115-6, 128-131 **********************************************************************/ /* '01jan1970:00:00'dt is a SAS datetime constant. This is the number of seconds between 01jan1960 and 01jan1970. Now, just add this number to the C datetime value. We now have the number of seconds since 01jan1960, a SAS datetime value. */ data test; input cdatetme; sasdate = cdatetme + '01jan1970:00:00'dt; put sasdate= datetime16.; cards; 728865000 728865020 728865040 728865050 ; run;