BookmarkSubscribeRSS Feed
deleted_user
Not applicable

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

3 REPLIES 3
Ksharp
Super User

Only have what ?

Astounding
PROC Star

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.

MadhuKorni
Quartz | Level 8

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*^

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1351 views
  • 0 likes
  • 4 in conversation