I am trying to merge, but instead of merging by my by variable, SAS instead vertically concatenates the datasets on top of each other
Find two values from the two different sources that look the same to you and display them using the $HEX format. Compare the values until you see a difference. Specific hexcodes to look for that will cause trouble because they are not normally displayed as any ink on the page are:
20 - space
09 - tab
0A - linefeed
0D - carriage return
A0 - non-breaking space
00 - null
FF - ???
You get this behaviour because jobid and jobcode don't match exactly for any of your data. Start by making sure the two variables have the same length. Then look at one value that should match, but doesn't. For example one of variables might contain leading blanks.
This is a classic case of Maxim 3: Know Your Data.
Leading blanks (as already mentioned) can cause this. You also could have a format assigned that visually creates the same value. $UPCASE will display "bagclk" as "BAGCLK", but the raw values won't match, and SAS uses those for a join.
Run a proc contents on your datasets first, then inquire further.
I checked this, but both values have the same length and type. I even tried to create a new variable using Upcase, but i am still getting the same issue
Find two values from the two different sources that look the same to you and display them using the $HEX format. Compare the values until you see a difference. Specific hexcodes to look for that will cause trouble because they are not normally displayed as any ink on the page are:
20 - space
09 - tab
0A - linefeed
0D - carriage return
A0 - non-breaking space
00 - null
FF - ???
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.