1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data list fixed /date1 1-10(a).
begin data
01JAN1992
05FEB2001
end data.

* Method 1.
string mm(A3).
compute yr=number(substr(date1,6,4),f4).
compute mm=substr(date1,3,3).
compute da=number(substr(date1,1,2),f4).
recode mm (convert) ('JAN'=1) ('FEB'=2) ('MAR'=3) INTO mo.
compute date2=date.dmy(da,mo,yr).
formats date2(adate10).
variable width date2(11).
execute.

* Method 2  (better).
STRING date2(a11).
COMPUTE date2=concat(substr(date1,1,2),"-",substr(date1,3,3),"-",substr(date1,6,4)).
VARIABLE WIDTH date2(11).
EXECUTE.