Desktop productivity for business analysts and programmers

How to filter for single non joined words like "PAY" but not joined words containing PAY such as "PAYPAL", "BPAY" "PAYED"

Reply
New Contributor
Posts: 2

How to filter for single non joined words like "PAY" but not joined words containing PAY such as "PAYPAL", "BPAY" "PAYED"

I am trying to filter out records with the word "PAY" in the description but I want to filter out words containing PAY.

So for example if the description says

JOHN SMITH WEEKLY PAY

Then I wish to include this record as the word PAY is by itself. However if the Description is in the form of

PAYPAL , BPAY, PAYED

or any characters or words that start, has pay in the middle or ends with pay, then I wish to exclude the record.

Is there anyway to be able to do this?

Trusted Advisor
Posts: 1,203

Re: How to filter for single non joined words like "PAY" but not joined words containing PAY such as "PAYPAL", "BPAY" "PAYED"

Try this.

data want;

set have;

if findw(name,'PAY')>0 then output;

run;

Grand Advisor
Posts: 9,596

Re: How to filter for single non joined words like "PAY" but not joined words containing PAY such as "PAYPAL", "BPAY" "PAYED"

OR perl regular expression :

if prxmatch('/\bPAY\b /',name) ;

Ask a Question
Discussion stats
  • 2 replies
  • 304 views
  • 0 likes
  • 3 in conversation