Dear,
I need to populates total number of subjects to all OBS in data1 to calculate percentages.
With my code the values from data2 only polulating to first OBS in data1. Please help. Thanks
code;
data3;
merge data1 data2;
run;
data1
Text 100mg 200mg
Teae due to drug 10 15
Teae due to procedure 5 8
mild teae 3 9
moderate teae 4 6
data2 (Total number of subjects)
100mg 200mg
50 65
output need;
Text 100mg 200mg 100mgTNS 200mgTNS
Teae due to drug 10 15 50 65
Teae due to procedure 5 8 50 65
mild teae 3 9 50 65
moderate teae 4 6 50 65
output getting;
ext 100mg 200mg 100mgTNS 200mg
Teae due to drug 10 15 50 65
Teae due to procedure 5 8
mild teae 3 9
moderate teae 4 6
This probably isn't the most efficient method, but it will work:
data data3 (drop=n); set data1; n=1; set data2 (rename=(_100mg=_100mgTNS _200mg=_200mgTNS)) point=n; run;
HTH,
Art, CEO, AnalystFinder.com
A commonplace method:
data data3; set data1; if _n_=1 then set data2 (rename=(_100mg=_100mgTNS _200mg=_200mgTNS)); run;
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.