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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: