data raw; input stckcd 1. @3 date $7.+1return 2.; cards; 1 1995-01 1 1 1995-02 2 1 1995-03 3 1 1995-04 4 1 1995-05 5 1 1996-01 11 1 1996-02 22 1 1996-03 33 1 1996-04 44 2 1995-01 6 2 1995-02 7 2 1995-03 8 2 1995-04 9 2 1996-01 66 2 1996-02 77 2 1996-03 88 ; run; data raw1; set raw; year=year(mdy(input(scan(date,2),2.),1,input(scan(date,1),4.))); month=month(mdy(input(scan(date,2),2.),1,input(scan(date,1),4.))); run; proc print data=raw1;run; Obs stckcd date return year month 1 1 1995-01 1 1995 1 2 1 1995-02 2 1995 2 3 1 1995-03 3 1995 3 4 1 1995-04 4 1995 4 5 1 1995-05 5 1995 5 6 1 1996-01 11 1996 1 7 1 1996-02 22 1996 2 8 1 1996-03 33 1996 3 9 1 1996-04 44 1996 4 10 2 1995-01 6 1995 1 11 2 1995-02 7 1995 2 12 2 1995-03 8 1995 3 13 2 1995-04 9 1995 4 14 2 1996-01 66 1996 1 15 2 1996-02 77 1996 2 16 2 1996-03 88 1996 3
... View more