Return to Archive

SAS Tip of the Month
August 2007

You have just received a dataset from a European client and you open the dataset in SAS Viewer and note that the dates are in dd/mm/yy format, not what you want for your report in New York this morning which is mm/dd/yy format.

Don't fret. A date that is stored in a numeric variable inside a SAS dataset is the number of days since January 1, 1960, so internally to the variable (without the FORMAT specification) it does not care what format you what it displayed in.

To solve the problem, the display of the date can be set to mm/dd/yy format using the format MMDDYY8. that can be put in a PRINT or REPORT procedure anywhere, using the following statement:

   FORMAT MMDDYY8.

As a useful tip, an international standard that has been adopted is to have the dates in yyyy-mm-dd format (SAS format YYMMDD10.) and avoids the confusion between US mm/dd/yyyy format (SAS format MMDDYY8.) and European format dd/mm/yyyy (SAS format DDMMYY8.), or adopt the standard SAS date format ddMMMyyyy format (SAS format DATE9.) for variables containing dates within your dataset.

________________________________
Updated August 1, 2007