BookmarkSubscribeRSS Feed
Ranjeeta
Pyrite | Level 9

Can Someone please advise how I can get the final output using Table 1 and Table 2

 

Thankyou 

 

3 REPLIES 3
novinosrin
Tourmaline | Level 20

Are you asking for an inner join?

 

data have1;
infile cards truncover;
input INST	FAC_NUM;
cards;
4265	948
4266	948
;

data have2;
input INST_AM	INST_AT	FAC_NUM;
cards;
4265	4266	948
;

proc sql;
create table want as
select a.*,INST_AT
from have1 a,have2 b
where a.inst=b.inst_am and a.fac_num=b.fac_num;
quit;
Ranjeeta
Pyrite | Level 9

Thankyou but I need two columns the INST_AT as well so how would I modify the code

 

Also I need to have the repeated row deleted and get the final output as in the EXCEl

proc sql;
create table want as
select a.*,INST_AM,INST_AT
from new a,inst_trans b
where a.id=b.inst_am and a.fac_num=b.fac_num
or a.id=b.inst_at and a.fac_num=b.fac_num ;
quit;

novinosrin
Tourmaline | Level 20

Not sure what you are saying. When i ran -

proc sql;
create table want as
select a.*,INST_AT
from have1 a,have2 b
where a.inst=b.inst_am and a.fac_num=b.fac_num;
quit;

proc print noobs;run;

I get this.

INST FAC_NUM INST_AT
4265 948 4266

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 713 views
  • 0 likes
  • 2 in conversation