Hi
I have 3 tables:
data table1;
input String $;
datalines;
APPLE
BANNANA
ORANGE
PECAN
CITY
;
run;
data table2;
input id APPLE BANNANA ORANGE WALNUT PECAN ALMOND CITY $;
datalines;
111 15 2 34 22 10 12 KRA
112 3 33 45 5 33 45 WRO
113 34 78 90 6 67 34 SUW
114 12 43 56 7 89 0 WAW
run;
data table3;
input id;
datalines;
111
113
114
;
run;
From table 1 need names(string), from table 3 id and result from table 3
id | APPLE | BANNANA | ORANGE | PECAN | CITY |
111 | 15 | 2 | 34 | 10 | KRA |
113 | 34 | 78 | 90 | 67 | SUW |
114 | 12 | 43 | 56 | 89 | WAW |
I will be grateful for suggestions.
proc sql noprint;
select string into :names separated by ',' from table1;
quit;
proc sql;
create table want as select id,&names from table2
where id in (select distinct id from table3);
quit;
proc sql noprint;
select string into :names separated by ',' from table1;
quit;
proc sql;
create table want as select id,&names from table2
where id in (select distinct id from table3);
quit;
Thank You PaigeMiller
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.