DATA S ;
NAME='ROITNCV42365672-908$#&^*(#$' ;
NEW=COMPRESS(NAME,'24' ,'KD') ;
RUN;
I WANT TO KEEP ONLY DIGITS AND WITH IN DIGITS I DON'T NEED 2,4 NUMBERS .
IS ABOVE PROGRAM CORRECT ?
USE OF SECOND ARGUMENT?
TRY PRESSING THE CAPS LOCK BUTTON, ITS OFFENSIVE TO BE SHOUTED AT!!
You need two compress statements, inner to keep digits, outer to remove 2 and 4:
data s; name='ROITNCV42365672-908$#&^*(#$'; new=compress(compress(name," ","kd"),'24'); run;
You do not read others replies completely. STOP using all UPPERCASE. YOU are shouting at us.
@thanikondharish you're probably aware but this is a community forum, everyone answering your questions is likely exactly like you either studying at school or working a full time job. There are some SAS employee's on here, but they're identified as such as well. Please take the time to properly format your questions and to mark them solved when someone has taken the time to answer it.
@VDD This is an entirely optional activity, so my solution is to not engage/respond further 😉
Probably easier to just list the digits you want to keep.
compress(xxx,'01356789','k')
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.