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')
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.