Merge BY will take the values from the right most dataset on the merge statement with the named variable. So if work.B is missing a value for variable XYZZY, then the resulting data set will have a missing value for XYZZY.
Notice in this example that the values for the variable B all come from dataset work.two except for the value of A that is not in work.two.
data work.one;
input a b;
datalines;
1 24
2 34
3 44
4 66
;
run;
data work.two;
input a b;
datalines;
1 .
2 33
3 99
;
run;
data merged;
merge work.one work.two;
by a;
run;
Expand this to 17 files it can get very difficult to guess which data set may be causing a specific missing result.
Are the variables in the A datasets all supposed to be the same or do they have different variables in some?
If a variable only has values in one data set, then if it doesn't contribute to all records on the BY variable value then those records without a match will be missing as well.
... View more