Using SAS 9.4
proc sql;
create table work.HN_Sepsis_merge_121918 as
select a.*, b.sepsis_code
from working.sepsis_HN_12182018 as a
left join raw.sepsis_codes_112918 as b
on a.diag_cd=b.diag_cd;
quit;
I am merging on diagnosis code and for the majority it is not a problem (eg. a04.7), however for some codes (eg. S00.31Xa) they are not matching when the code is in both datasets. All of the codes that are not matching have the same combination of numbers and letters. I have tried 'compress' to see if that was the problem and that did not work. Both are character variables with the same length, format and informat. Any ideas would be great, Thanks!
Show us an example of ACTUAL data in both of your data sets (a screen capture of actual data in each data set ought to be fine) (via a PROC PRINT output of a few records pasted into the {i} box) that doesn't merge properly.
Sir , Come on don't say screen capture, I am lazy to type. I would rather prefer as plain text for copy/paste or if OP is comfortable giving us in the form of datastep, even better.
The reason I want a screen capture here of the data set is that there may be blanks at the beginning of the value that will prevent merging, and this will not be obvious if someone types text to represent the values. But I see your point, a PROC PRINT of a few records would work if done properly and pasted into the {i} box.
Their are not blanks, I used the compress and strip functions first to see if that was the issue
We want you to show us examples that don't merge. There are other reasons than blanks why they will not merge.
@GS2 wrote:
Their are not blanks, I used the compress and strip functions first to see if that was the issue
Null characters, ASCII 255, would not necessarily be removed by Compress, depending on actual Call. Strip won't remove nulls either.
Capitalization? X vs x
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.