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

Hi all,

I've been going through my data and realized that I have " • " scattered in my strings...

I have been trying to get rid of it via TRANWRD. But it just makes no difference...

I then used translate to translate it to my other characters, no changes at all but no error in my log...

does anyone know how to remove it?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Another alternative, rather than guessing what the ascii code might be, is simply to copy and paste it into either the translate or compress function. e.g.:

 

data have;
  length string $80.;
  input string &;
  cards;
this is • that was
my oh • oh my
;

data test;
  set have;
  string=compbl(compress(string,'•'));
run;

Art, CEO, AnalystFinder.com

 

View solution in original post

6 REPLIES 6
novinosrin
Tourmaline | Level 20

 get rid of '.' ? sure?

 

new_var=compress(var,'.');
novinosrin
Tourmaline | Level 20

Oh well,  " • " looks certainly different to " . "

error_prone
Barite | Level 11
Posting code is necessary to explain possible mistakes. Use compress instead of tranwrd to remove unwanted chars.
Astounding
PROC Star

As best I can tell, the character in question has a hex code of 95.  So you should be able to convert those to blanks using:

 

var = translate(var, '20'x, '95'x);

 

You might have to test to see if that's actually the right hex code, since the text has been copied a couple of times before I get to test it.  So here's the type of program you can use:

 

data _null_;

ch = " • ";

put ch $hex8.;

ch = translate(ch, '20'x, '95'x);

put ch $hex8.;

run;

art297
Opal | Level 21

Another alternative, rather than guessing what the ascii code might be, is simply to copy and paste it into either the translate or compress function. e.g.:

 

data have;
  length string $80.;
  input string &;
  cards;
this is • that was
my oh • oh my
;

data test;
  set have;
  string=compbl(compress(string,'•'));
run;

Art, CEO, AnalystFinder.com

 

AlexMoreton
Obsidian | Level 7

Thank you Art!

That worked!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1404 views
  • 2 likes
  • 5 in conversation