BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nithya_r99
Calcite | Level 5

I am trying to merge, but instead of merging by my by variable, SAS instead vertically concatenates the datasets on top of each other

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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 - ???

 

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

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. 

Kurt_Bremser
Super User

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.

nithya_r99
Calcite | Level 5

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

Tom
Super User Tom
Super User

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 - ???

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 468 views
  • 0 likes
  • 4 in conversation