How to avoid data set merging problems when common BY variable has different lengths?
When merging 2 datasets with a common by-variable and when that common variable has different variable length, the merge process produce unexpected results. If you use SAS 9.2 version like me, then SAS Data step will inform you with the following warning: WARNING: Multiple lengths were specified for the BY variable ****** by input data sets. This may cause unexpected results. It is good that at least starting SAS 9.2 version, data step issues a Warning message to inform the programmer. But if you use before versions, it is difficult to notice this potential disaster. When you see this WARNING message in the SAS log, we might be inclined to ignore this warning because we think this is just a WARNING never realizing the potential danger. When you see this message in the LOG we should be thinking about this instead of avoiding because SAS will do exactly what it states: it may cause unexpected results . In some cases merge won’t even happen between datasets and so...