I have a date column which dates are showing as numeric, such as "201101", "201203"... How can I convert these numeric date into format as "Jan2011", "Mar2012" by using SAS enterprise? Thanks!
Asked
Active
Viewed 1,426 times
-2
-
Have you tried anything yet? – DeadChex Jun 25 '15 at 21:29
-
I am new to SAS, tried several ways, but not work – Shirley Jun 27 '15 at 20:39
2 Answers
1
You can do it like this:
DATA test;
input date;
CARDS;
201101
201203
;
RUN;
data test2;
set test;
date2 = input(put(date,6.),yymmn6.);
format date2 monyy7.;
run;

Martí Mayo
- 31
- 5
-
I tried yours, but it deletes all other columns, only the date columns left. I am new to SAS, is there anyway to transfer the column without delete others? – Shirley Jun 27 '15 at 20:38
0
Marti Mayo's answer is correct - but just wanted to point out that it only needs the one step:
DATA test;
format date monyy7. ; *<--- Sets the format you want to view (JAN2011) ;
input date :yymmn6.; *<--- Sets the informat of what you read in(201101);
CARDS;
201101
201203
;RUN;

Bendy
- 3,506
- 6
- 40
- 71