Text mining and content categorization

Output only special characters

Reply
N/A
Posts: 0

Output only special characters

Dear Experts,

Regret for posting this question in articles section. I tried to post it in discussions and every time i click post message i get a message that "Not allowed to post content more than once every 120 seconds". I waited for  a day hoping that this issue will be resolved, but its the same. So i had no option when i tried to post it here it worked.

This is with regard to a scenario where i would like to output special characters alone from the string.

consider that we have the following data

"james ,thom,son & eligbeth ' samm"

the output should have only

Grand Advisor
Posts: 9,446

Re: Output only special characters

Only have what ?

Respected Advisor
Posts: 4,755

Re: Output only special characters

Take a look at the COMPRESS function, especially the third parameter.  That controls what characters you would like to remove from an existing string, so you will be left with only the special characters.  It's up to you what "special" means, so look at the details of what is possible in that third parameter.

Contributor
Posts: 65

Re: Output only special characters

data have ;

input have $ 20.;

cards;

abc&def%ghi

abc*def^ghi

;

data want;

set have;

want = compress(have,,'kp');

run;

proc print; run;

Output :

1abc&def%ghi&%
2abc*def^ghi*^
Ask a Question
Discussion stats
  • 3 replies
  • 455 views
  • 0 likes
  • 4 in conversation