BookmarkSubscribeRSS Feed
Harish2
Calcite | Level 5

Hi team,

 

I have two tables 

table A
sl noName
1HARISH
2GIRISH
4RAMYA
5RAMU
6RAVI

 

 

table B
sl Noworking
3tcs
5tcs
2cts
1hp
4wipro
5ge
7NA

 

 

Need the output will be like below by using SAS code.Please help me to do this.

 

 

New Table 
sl noNamesl Noworking
1HARISH3tcs
2GIRISH5tcs
4RAMYA2cts
5RAMU1hp
6RAVI4wipro
  5ge
  7NA

 

 

Thanks,

harish

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Remember, two variables can not have the same name. 

 

Do something like this

 

data tableA;
input slno	Name $;
datalines;
1	HARISH
2	GIRISH
4	RAMYA
5	RAMU
6	RAVI
;

data tableB;
input slNo working $;
datalines;
3	tcs
5	tcs
2	cts
1	hp
4	wipro
5	ge
7	NA
;

data want;
   merge tableA tableB(rename=(slNo=slNo_B));
run;
Harish2
Calcite | Level 5

Thanks for your help.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 422 views
  • 0 likes
  • 2 in conversation