BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Batman
Quartz | Level 8

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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);

 

View solution in original post

3 REPLIES 3
Astounding
PROC Star

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);

 

Batman
Quartz | Level 8
Yes, thanks, I want to keep the space between states with two words.
ErikLund_Jensen
Rhodochrosite | Level 12

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.

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
  • 3 replies
  • 445 views
  • 0 likes
  • 3 in conversation