DATA Step, Macro, Functions and more

Prxmatch

Reply
Super Contributor
Posts: 702

Prxmatch

I would like to use prxmatch on two columns from two tables in a proc Sql. But it doesn't seem to work.

Here is the logic I tried.

Proc sql;

Where prxmatch(a.text,b.text)>0

Quit;
PROC Star
Posts: 2,215

Re: Prxmatch

[ Edited ]

Please look at the documentation. The first parameter must be a regular expression. I have to learn regular expressions before you can use that function.

Super Contributor
Posts: 702

Re: Prxmatch

I know, but something in that likes. A fuzzy match is required.

PROC Star
Posts: 2,215

Re: Prxmatch

What are the match criteria? Have you looked at the spelling distance functions?

PROC Star
Posts: 8,094

Re: Prxmatch

Are you trying to do something like the following:

data have1;
  input text $;
  cards;
abc
bcd
bca
fgf
;
data have2;
  input text $;
  cards;
bcd
fgf
;

proc sql;
  select text
    into :from1
      separated by '|'
        from have2
  ;

  create table want as
    select text
      from have1
        where prxmatch('m/&from1/oi',text)>0
  ;
quit;

Art, CEO, AnalystFinder.com

 

Super Contributor
Posts: 702

Re: Prxmatch

Yes Art, Something in that likes!

Super Contributor
Posts: 702

Re: Prxmatch

there are special characters to be compressed from both have1 and have2 as they are not consisternt for matching

PROC Star
Posts: 8,094

Re: Prxmatch

Can you provide examples of both datasets and what you want to match from them?

 

Art, CEO, AnalystFinder.com

 

Super Contributor
Posts: 702

Re: Prxmatch

the data from two sources is like this,

 

Have1

Finance Exchequer Credit Bankrupt and Mortgage

 

Have2
Finance,exchequer,Credit Bankrupt and Mortgage

 

 

Trying to match with whole pattern or part of it.

PROC Star
Posts: 2,215

Re: Prxmatch

Why not remove the unwanted characters with function compress, and then use spelling distance? 

PROC Star
Posts: 2,215

Re: Prxmatch

Your example matches with 


upcase(compress(TEXT1,' ,')) =  upcase(compress(TEXT2,' ,'))
Super Contributor
Posts: 702

Re: Prxmatch

Not always do I get the same pattern. Thats why I'm relying on fuzzy match

PROC Star
Posts: 8,094

Re: Prxmatch

Your example doesn't include any fuzzy or fuzzy-like instances. Can you provide an example that does. And, your example appears to have one record with just one variable (containing multiple words) in each file. Is that what you actually have?

 

Art, CEO, AnalystFinder.com

 

Super Contributor
Posts: 702

Re: Prxmatch

Yes Art!

Super Contributor
Posts: 702

Re: Prxmatch

even if partially matches that is fine too.
Ask a Question
Discussion stats
  • 17 replies
  • 213 views
  • 0 likes
  • 4 in conversation