data have;
input ReAdm1-ReAdm2;
datalines;
1 2012
2 2013
3 2015
;
run;
want output in one column like JAN-2012,FEB-2013,MAR-2015
what i can do for it
thanks in advance
MDY function in either data step or SQL.
In the future please post what you've tried ahead of time so we can effectively help you.
like this?
data have;
input ReAdm1 ReAdm2;
datalines;
1 2012
2 2013
3 2015
;
run;
data want;
set have;
date = mdy(ReAdm1,1,ReAdm2);
format date monyy7.;
run;
MDY function in either data step or SQL.
In the future please post what you've tried ahead of time so we can effectively help you.
Thank you for reply but i know that answer is coming like that
put date monyy7.; | MAY2012 |
but you have not seen my questions properly i want MAY-2012 instead of MAY2012 but thank you for time
i did it.. for less time i asked that question over here
data have;
input ReAdm1 ReAdm2;
datalines;
1 2012
2 2013
3 2015
;
run;
proc sql;
select *, mdy(readm1, 01, readm2) as date format=date11.,
substr (put(calculated date,date11.),4,length(put(calculated date,date11.))) as date
from have;
quit;
@ganeshmule wrote:
but you have not seen my questions properly i want MAY-2012 instead of MAY2012 but thank you for time
i did it.. for less time i asked that question over here
I would like to assume you've tried everything before posting here in the first place.
FYI - you don't need the third parameter in the SUBSTR function.
data have;
input ReAdm1 ReAdm2;
datalines;
1 2012
2 2013
3 2015
;
run;
data want;
set have;
mydate=mdy(readm1, 1, readm2);
mydate2=catx('-', put(mydate, monname3.), put(mydate, year4.));
mydate3 = substr(put(mydate, date11.), 4);
run;
proc print data=want;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.