Creation date: 11/29/1999
Authored by: Karl Ho
Question:
How to convert a year-leading date (930101) into a day-leading date (010193)?
Answer:
In order to have a zero-leading value, the variable has to be in string format. The following syntax converts the date variable into a day-leading format:
*Date is the original variable and Date1 is the new variable, which
has to be string because of the leading zero.
string date1 (a6).
compute date1=concat(substr(string(date,f6.0),3,4),substr(string(date,f6.0),1,2)).
exec.
Note that the new date1 is string and can be sorted but not be analyzed. But you can convert it into numeric format:
compute date2=number(date1,f6.0).
Last updated: 01/18/06 by Karl Ho