I haven't used SAS in a while so this is probably a simple request, but I am having issues creating the dataset I want.
data have1;
input id group $;
cards;
1 a
1 b
1 c
;
run;
data have2;
input id samplevalue;
cards;
1 0.25
1 0.50
1 0.75
;
run;
data want;
input id samplevalue group $;
cards;
1 0.25 a
1 0.50 a
1 0.75 a
1 0.25 b
1 0.50 b
1 0.75 b
1 0.25 c
1 0.50 c
1 0.75 c
;
run;
Not the only way. Proc SQL will allow joins on multiple values of matching variables where a data step merge typically doesn't yield the result desired when there are multiples of BY variables in both data sets.
proc sql;
create table want as
select a.*,b.samplevalue
from have1 as a
full join
have2 as b
on a.id=b.id
order by a.id, a.group, b.samplevalue
;
quit;
Thank you so much, this is exactly what I needed and it works perfectly!
Ready to join fellow brilliant minds for the SAS Hackathon?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.