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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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