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 😉
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
  • 1425 views
  • 0 likes
  • 3 in conversation