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.;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.