BookmarkSubscribeRSS Feed
radhikaa4
Calcite | Level 5

Hello,

 

I have 2 datasets and I would like to create 3rd dataset 

 

Dataset #1

 

patientIDdatevolume
44441/2/201445
44441/3/201450
44441/4/201412
44441/5/201433
44441/6/201412
32331/6/201566
32331/7/201535
32331/9/201523

 

Dataset #2

patientIDdateflag
44441/4/20141
32331/7/20151

 

Want dataset #3

patientIDdatevolumeflag
44441/2/201445 
44441/3/201450 
44441/4/2014121
44441/5/201433 
44441/6/201412 
32331/6/201566 
32331/7/2015351
32331/9/201523 

 

I tried the following

PROC SQL;

SELECT bb.*, cc.flag

FROM a.dataset_1 bb LEFT JOIN a.dataset_2 cc on bb.patientID = cc.patientID;

QUIT;

 

But it doesn't work or shows "flag = 1" for all the records. I also tried full outer join etc. 


Thanks

1 REPLY 1
Reeza
Super User
Add a condition to join on date as well.

and bb.date=cc.date