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

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.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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