BookmarkSubscribeRSS Feed
factorhedge
Fluorite | Level 6

Hi I need to merge two tables (Table A , Table B ) the tables look like as illustrated below

Table A (The first column is unique ID for 400 rows, second column is YYYYMM date column goes from 200001 to 201012, third column is Value

CodeIdDateAUM
10326200001200
10326200001200
10345
200003340
....200204...
....200512...
10328201012...

Table B (First column has similar unique ID as table A and date in column two is YYYYMM but its random not necessarily continuous dates)

CodeIdDate
10326200001
10348200312
10356200902

Objective : Is to merge the two sheets based on 2 variables (CodeID and Dates) . I need the output to show AUM value in Table B after matching with specific CodeID and specific date.

Output table

CodeIDDateAUM
10326200001Value for 10326 and 200001 date from Table A
10348200312

I have tried proc sql using where but didnt work for me , could someone please help me.

2 REPLIES 2
allurai0412
Fluorite | Level 6

hi,

check this....if really want unique 'Codeid'

proc sql;

select distinct a.codeid ,a.aum, b.date from table_a a inner  join   table_b b

on a.codeid=b.codeid and a.date=b.date ;

run;

Regards

Allu

PGStats
Opal | Level 21

Or simply

proc sql;

select * from table_A natural join table_B;

quit;

PG

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 2 replies
  • 914 views
  • 0 likes
  • 3 in conversation