Hello,
I have a character string which contains the words with the combination of characters, numbers and special character.
Now I would like to find/extract only the particular string which is in below mentioned format.
Input string : " 10% discount to be given to accidental insurance customers in 9874-04562 on a pro rata basis"
Output Sub string : 9874-04562
Thanks in advance.
You can use regular expressions:
data _null_;
if _N_ = 1 then
do;
retain rId;
rId = prxparse('/\d{4}-\d{5}/');
end;
str = ' 10% discount to be given to accidental insurance customers in 9874-04562 on a pro rata basis';
call prxsubstr(rId, str, pos, len);
if pos ^= 0 then
match = substr(str, pos, len);
put match=;
run;
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.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for:
View all other training opportunities.