Data one; input var1 $;
datalines;
scan
MRI
;run;
Data two; input res1 res2;
datalines;
10
45
13
56
; run;
OUTPUT: IN ONE DATASET
Var1 res1 res2
scan 10 45
scan 13 56
MRI 10 45
MRI 13 56
The SQL solution already posted is easier, but for a DATA step:
data want;
set one;
do _n_=1 to _nobs_;
set two point=_n_ nobs=_nobs_;
output;
end;
run;
Please provide valid and tested SAS syntax creating DATA ONE and DATA TWO.
Untested (as I didn't feel like fixing the data steps)
proc sql;
create table want as
select *
from one,two
;
quit;
Hereafter It will not repeat and Thank you!
Can you please help out In Data Step Method ...for the same Problem
The SQL solution already posted is easier, but for a DATA step:
data want;
set one;
do _n_=1 to _nobs_;
set two point=_n_ nobs=_nobs_;
output;
end;
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.