I need to combine cc , yy, mm, dd numeric variable into 1 variable. mm can be input as 3 so i need to make it 03 first and then merge into one variable.
I need to do this with all variables.
Not sure how to do any help please.
Thanks.
Thankyou Guys for replay and great help...
I wrote the code like below and it worked. THANKS AGAIN!
ELIG_CERT_EFF_DATE =mdy(mm,dd,100*cc+yy);
format ELIG_CERT_EFF_DATE mmddyyn8.;
Since they are numeric, not character, variables, it doesn't matter that some mm, some dd, or some yy are single digits (I presume cc is 19 or 20). You'll use numeric operations and numeric function on them.
my_date=mdy(mm,dd,100*cc+yy);
format my_date date9.;
@sgarg wrote:
I need to combine cc , yy, mm, dd numeric variable into 1 variable.
OK. What do you want as the output in that variable?
@sgarg wrote:
mm can be input as 3 so i need to make it 03 first and then merge into one variable.
Show what you have and what you need as output, explicitly.
@sgarg wrote:
I need to do this with all variables.
You've indicated three variables, how many variables do you have? What have you tried so far?
Do you instead mean you need to do this for all rows/records or for multiple different day/month/year variables?
Thankyou Guys for replay and great help...
I wrote the code like below and it worked. THANKS AGAIN!
ELIG_CERT_EFF_DATE =mdy(mm,dd,100*cc+yy);
format ELIG_CERT_EFF_DATE mmddyyn8.;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.