Hello:
I would like to remove some charaters from different postions in the string. Please advice.
The data are list below:
lab_den_pcr_perf_1
mhh_cyto_tests_1__cfdna
nad_cert_30
nad_imag_find___abn_cort_gyr
And I would like to change them to:
lab_den_pcr_perf
mhh_cyto_tests__cfdna
nad_cert
nad_imag_find
/*In the below case i am suppressing only the digits whereever they are located in the string*/
data have;
input text$100.;
cards;
lab_den_pcr_perf_1
mhh_cyto_tests_1__cfdna
nad_cert_30
nad_imag_find___abn_cort_gyr
;
data want;
set have;
new=prxchange('s/\d+//',-1,text);
run;
What are the rules?
As per suggestion of @Reeza , please provide some information, so that someone call help you. I find regular expressions very helpful for this kind of scenarios
/*In the below case i am suppressing only the digits whereever they are located in the string*/
data have;
input text$100.;
cards;
lab_den_pcr_perf_1
mhh_cyto_tests_1__cfdna
nad_cert_30
nad_imag_find___abn_cort_gyr
;
data want;
set have;
new=prxchange('s/\d+//',-1,text);
run;
Thanks for the great suggestion. will looking into the prxchange function.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.