- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.