Hi everybody,
When I'm merging two data sets A and B by a common variable ID, if there are two rows entirely filled for an ID in A and one row partially filled for the same ID in B, after the merge I obtain 2 rows entirely filled (missing values in B are replaced by A values).
The problem is I would like to keep an empty field, of course.
Here is my code :
**********************************************************
DATA tmp;
MERGE
tmp_2008 (in=a keep=id dat_2008)
tmp_2009 (in=b keep=id dat_2009)
BY id;
run;
**********************************************************
And the result :
id----------------dat_2008----------------------dat_2009----------
33882041 -- 16MAR2011:18:27:21 -- 17MAR2011:17:40:03
33882041 -- 16MAR2011:18:27:21 -- 22MAR2011:18:06:49
(Before merging, I have two rows in dat_2009, one in dat_2008 and after merging these data sets I don't want the duplicate value in the second row for dat_2008 but keep the field empty).
Hope to make myself clear,
Thanks a lot 🙂