Help using Base SAS procedures

String Matching Algortihm Development

Reply
N/A
Posts: 0

String Matching Algortihm Development

data libcan.hello2;
if _N_ = 1 then
do;
retain ExpressionID;
pattern = "/koy|avenue|dr|drive|rd|road/i";
ExpressionID = prxparse(pattern);
end;

input street $80.;
call prxsubstr(ExpressionID, street, position, length);
if position ^= 0 then
do;
match = substr(street, position, length);
put match:$QUOTE. "found in " street:$QUOTE.;
end;
datalines;
153 Bagdat Caddesi
6789 64uncu Koy
4 Moritz Road
7493 Ulus Yolu
;
run;


So main idea is at the bottom of the code there is my data set to be searched in and i have a pattern which will be searched in the dataset.
But my aim is to add a criteria to my code.
I want to search for the first word of the pattern in the first row of the dataset.

First pattern word matches? First row of the dataset
Second pattern word matches? Second row of the dataset
and so on.

How can i add a citeria like this to my existing code.
Could you please help me?

Best Regards,
Cakcan
Ask a Question
Discussion stats
  • 0 replies
  • 48 views
  • 0 likes
  • 1 in conversation