I have two values with same apparent text but different hex values
State=ALABAMA 414C4142414D4109
State=ALABAMA 414C4142414D4120
Is there a way to equalize the hex values so they can be merged?
If I recall, 09 is the hex code for a tab character. There's a small possibility that I'm wrong about that, but the fix is the same no matter what the different characters contain:
state = compress(state, '0920'x);
Remove the offending characters, and let SAS pad the values with trailing blanks.
I will investigate a little further, because you won't want to remove embedded blanks from NEW YORK, etc.
Confirmed that 09 is a tab, so begin there by removing just the tab characters:
state = compress(state, '09'x);
If I recall, 09 is the hex code for a tab character. There's a small possibility that I'm wrong about that, but the fix is the same no matter what the different characters contain:
state = compress(state, '0920'x);
Remove the offending characters, and let SAS pad the values with trailing blanks.
I will investigate a little further, because you won't want to remove embedded blanks from NEW YORK, etc.
Confirmed that 09 is a tab, so begin there by removing just the tab characters:
state = compress(state, '09'x);
Hi @Batman
x20 is the space character. A text variable has a fixed length in SAS and is padded with space characters, so the value will always end with x20x20x20... up to the variable length. So just compress the TAB character out as suggested by @Astounding, and everything will be fine.
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.