BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ganeshmule
Fluorite | Level 6

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  

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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. 

View solution in original post

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

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;
Reeza
Super User

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. 

ganeshmule
Fluorite | Level 6

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;

 

Reeza
Super User

@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;

 

 

ganeshmule
Fluorite | Level 6
Thank you ......😆

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1174 views
  • 0 likes
  • 3 in conversation