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
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
get rid of '.' ? sure?
new_var=compress(var,'.');
Oh well, " • " looks certainly different to " . "
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;
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
Thank you Art!
That worked!
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!
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.
Ready to level-up your skills? Choose your own adventure.