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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1370 views
  • 0 likes
  • 4 in conversation