Hi I want remove a bad data from a variable . so inthis obs between nicolas and 84989 there is a small icon am trying to remove that using sas in linux environment
I tried to do the same in sas eg using
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,'');
this is working but in linux environement the same is now working
In general I find it is better to write non 7-bit ASCII strings as HEX literals in the SAS code. That way the code works the same if you change the encoding setting you are running with.
So LOOK at the hex codes for the character by using the $HEX format.
Then write the code using the hexcode.
For example if that "box" is was just the hex code '0A'x (which is actually a linefeed) then you might use
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,'0A'x);
If the goal is to only keep normal characters then use the K modifier on the COMPRESS() function call to say that the list of characters are those that should be KEPT instead the default action of removing the listed characters. You can use COLLATE() to generate all of the printable 7-bit ASCII characters.
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,collate(32,126),'K');
In general I find it is better to write non 7-bit ASCII strings as HEX literals in the SAS code. That way the code works the same if you change the encoding setting you are running with.
So LOOK at the hex codes for the character by using the $HEX format.
Then write the code using the hexcode.
For example if that "box" is was just the hex code '0A'x (which is actually a linefeed) then you might use
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,'0A'x);
If the goal is to only keep normal characters then use the K modifier on the COMPRESS() function call to say that the list of characters are those that should be KEPT instead the default action of removing the listed characters. You can use COLLATE() to generate all of the printable 7-bit ASCII characters.
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,collate(32,126),'K');
@animesh123 wrote:
Hi I want remove a bad data from a variable . so inthis obs between nicolas and 84989 there is a small icon am trying to remove that using sas in linux environment
I tried to do the same in sas eg using
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,'');
this is working but in linux environement the same is now working
is this a one-time need to remove just one character from this string? Or in a larger data set do possibly other characters appear depending on the string that you want to remove?
@animesh123 wrote:
APPLCNT_CMT_TX=compress(APPLCNT_CMT_TX,'');
want to remove only this
And WHAT character is that exactly?
When I try to copy and paste from your post here into SAS editor it just ends up as the '1A'x character.
Which is just what SAS puts when it does not know how to transcode a character.
If that is the actual character you have then why does this forum display it as a box with an X in it when SAS and WORD display it as just an empty box?
WORD Example:
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.