convert numeric date into DATE in SAS Enterprise Guide

1.4k views Asked by At

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!

2

There are 2 answers

0
Bendy On

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;
1
Martí Mayo On

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;