BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
soumri
Quartz | Level 8

Hi everyone,
Is anyone can help me  to remove a special character from a variable regardless of its order in the variable.
here is the example:
what I have:
id                      Mesure
10/5201            0.012
10/6522            0.452
306/312            1.003
AC115/9            0.855

what I want (just delete the slash)
id                      Mesure
105201            0.012
106522            0.452
306312            1.003
AC1159            0.855

My database contains more than a million ids that contain special characters (/, -,*,.) that I just want to search for and remove them by keeping the other characters.
Thank you for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No.  Read the documentation, all you need is:

id=compress(id, '/');

View solution in original post

4 REPLIES 4
soumri
Quartz | Level 8

As I understand I have to put this code:

 

data want;set have;

id=compress(id, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'k');

run;

 

is this true?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

No.  Read the documentation, all you need is:

id=compress(id, '/');

soumri
Quartz | Level 8

Yes, it works well. tank you.

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 Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 25049 views
  • 3 likes
  • 3 in conversation