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.;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.