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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 636 views
  • 0 likes
  • 2 in conversation