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

I suspect I have hidden character '0A'X, 'M' in the variable.  When I sort and put id on this variable, SAS thinks the same value(to me) are different.  How to find out and change this hidden characters?  The program I run is

proc sort data = meds_new2
 out = meds_new3;
 by All_Managers;
run;
data meds_new4;
set meds_new3;
by All_Managers;
if first.All_Managers then count + 1;
run;

and the output I got is:

Capture.JPGthank you for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
In addition to @Astounding's suggestion, it's also worth checking the documentation, there's an 'S' modifier in the COMPRESS function to remove all spaces.

s or S adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, form feed, and NBSP ('A0'x, or 160 decimal ASCII) to the list of characters.

http://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0fcshr0ir3h73n1b845c4aq58hz.htm&...

View solution in original post

3 REPLIES 3
mhollifi
Obsidian | Level 7

I suspect I have hidden character '0A'X, 'M' in the variable.  When I sort and put id on this variable, SAS thinks the same value(to me) are different.  How to find out and change this hidden characters?  The program I run is

proc sort data = meds_new2
 out = meds_new3;
 by All_Managers;
run;
data meds_new4;
set meds_new3;
by All_Managers;
if first.All_Managers then count + 1;
run;

and the output I got is:

Capture.JPGthank you for your help.

Reeza
Super User
In addition to @Astounding's suggestion, it's also worth checking the documentation, there's an 'S' modifier in the COMPRESS function to remove all spaces.

s or S adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, form feed, and NBSP ('A0'x, or 160 decimal ASCII) to the list of characters.

http://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0fcshr0ir3h73n1b845c4aq58hz.htm&...
Astounding
PROC Star

If you know what the hidden character is, getting rid of it is easy:

 

all_managers = compress(all_managers, '0A'x);

 

If you don't know what the hidden character is you can find it with:

 

data temp;

set have;

all_managers = compress(all_managers, , 'ad');

run;

proc freq data=temp;

tables all_managers;

format all_managers $hex30.;

run;

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 13476 views
  • 6 likes
  • 3 in conversation