BookmarkSubscribeRSS Feed
Riteshdell
Quartz | Level 8

hello ALL,

 

I am looking for a  solution which extract only character (A-Z) and numeric (0-9) data, remove special character and space.

Is there any function for same.

 

Output should be : Ram7shaym

 

data temp;
input A $50.;
datalines;
Ram7$%?shay m
;
run;


 

3 REPLIES 3
andreas_lds
Jade | Level 19
The function translate can do this, maybe you need to call it more than once.
Patrick
Opal | Level 21

@andreas_lds

Sounds like a use case for the compress() function.

data temp;
  input A $50.;
  wantstr=compress(a,,'kda');
  datalines;
Ram7$%?shay m
;
run;
andreas_lds
Jade | Level 19
@Patrick: of course, compress is the easier way to solve this 😉

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1397 views
  • 0 likes
  • 3 in conversation