The merging seems to work fine - I checked the individual records before and after. I also verified the results with and without the "if" statement. To address your question - there are specific histology codes that are associated with non-Hodgkin lymphoma and leukemia. The "map" dataset, therefore, provides the correct diagnosis code to each of the histology codes from the "lymphoma" dataset. However, if a record with a non-Hodgkin lymphoma histology occurs at a site related to the brain or nervous system (700<=sitecd<=729), we want those records coded specifically to "central nervous system lymphoma" (diagcd 38). This is what the if statement is trying to accomplish, but for some reason, it's also mapping diagcd 38 to other sites. I attached datasets in my original posting, which I hope will illustrate the problem. If you run: proc freq data=lymphoma2; tables diagcd*sitecd/list; run; you'll see that there are sitecd>729 that were mapped to diagcd=38. Without the "if" statement in the data step, those records would have been mapped to diagcd=37 or 39.
... View more