Hello,
I have 2 datasets and I would like to create 3rd dataset
Dataset #1
patientID | date | volume |
4444 | 1/2/2014 | 45 |
4444 | 1/3/2014 | 50 |
4444 | 1/4/2014 | 12 |
4444 | 1/5/2014 | 33 |
4444 | 1/6/2014 | 12 |
3233 | 1/6/2015 | 66 |
3233 | 1/7/2015 | 35 |
3233 | 1/9/2015 | 23 |
Dataset #2
patientID | date | flag |
4444 | 1/4/2014 | 1 |
3233 | 1/7/2015 | 1 |
Want dataset #3
patientID | date | volume | flag |
4444 | 1/2/2014 | 45 | |
4444 | 1/3/2014 | 50 | |
4444 | 1/4/2014 | 12 | 1 |
4444 | 1/5/2014 | 33 | |
4444 | 1/6/2014 | 12 | |
3233 | 1/6/2015 | 66 | |
3233 | 1/7/2015 | 35 | 1 |
3233 | 1/9/2015 | 23 | |
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