I have thousand of rows of subject titles. I want to sieve out subject titles based on what I entered in a search parameter. Therefore I have an advanced filter like this in a list table:
Upcase (subject title) contains Upcase (search parameter)
So if I entered "cat" in the text input box (embed with a search parameter), the list table should show all subject titles contain "cat". BUT, here's the problem: I don't want words that contains "cat" in their spelling, like "application" or "allocation", to be part of the results. I only want those that literally have the word "cat" in the subject titles.
Please help. Thank you.
Hi @mattneo
You can use either one of the following functions:
data want;
set have;
where findw(subject_title,"cat"," ","i"); /* i modifier specifies that the search is case insensitive*/
run;
or
data want;
set have;
where prxmatch('/\bcat\b/i',subject_title); /* i modifier specifies that the search is case insensitive and the meta character \b looks for a word boundary*/
run;
Best,
Thanks for the reply. However, I presumed these are codes to be applied some place? Sorry, I forgot to mention I am using SAS VA 8.3 and have the access to build reports and dashboards.
Not sure if it's possible to copy and paste the below codes to the text portion in Advanced Filter to make it work. But I don't remember seeing operators like "findw" in it. Any ideas on how to meet my needs with the Operators in SAS VA? I was thinking to apply the following in Advanced Filter:
UpCase( GetWord( Subject_title, Search Parameter, x) Contains Upcase( Search parameter) ,
where Search parameter = "cat" here
x is a number for the location to find the word "cat" within the subject title.
The thing is x can be any number for different subject titles. Hence I am stuck again.
Any help and ideas will be appreciated. Cheers.
Hi!
I tried to add ' ' (space) before and after my search parameter. I also added logic for missing search Parameter and think it works, is that what you want?
Parameter name: 'searchPar'p
Variable name: myStringVar
IF ( 'searchPar'p Missing )
RETURN ( 1 = 1 )
ELSE ( UpCase('myStringVar'n) Contains UpCase(Concatenate(Concatenate(' ', 'searchPar'p), ' ')) )
//Fredrik
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.