I want to extract text from a string using mutiples patterns. I am getting error "The PRXPARSE function call does not have enough arguments.".
data have;
input street $80.;
datalines;
Bldg A 153 First Street
6789 64th Ave
4 Moritz Road
7493 Wilkes Place
;
run;
%macro test;
%global p1 p2 p3 p4 ;
data want;
set have;
pattern1 = "m/\d+\s[a-z]+\s[a-z]+/oi";
pattern2 = "m/Pl|place/i";
pattern3 = "m/rd|road/i";
pattern4 = "m/ave|avenue/i";
%do i=1 %to 4;
call symputx(cats('p',&i), cats('pattern',&i.) , 'g');
%end;
%do j=1 %to 4;
ExpressionID = prxparse(&&p&j);
call prxsubstr(ExpressionID, street, position, length);
%if length> 0 %then
%do;
match = substr(street, position, length);
matchtype=cats('pattern',&j);
output;
%end;
%end;
drop Pattern:;
run;
%mend;
%test;
... View more