Hello,
I am looking for multple words within title. I am not able to get this work. Please if you can help
data A;
input title $1-39;
datalines;
A TALE OF TWO CITIES
GENERAL MANAGER IN ONE CITY
MANAGER IS IN ANOTHER CITY
MANAGER IS NOT IN THE CITY
run;
data work;
set A;
WORD=FIND(title,("IS IN","IS NOT","i"); /**** "i" is to handle the case insensitive ****/
run;
Maybe a regular expression?
word = prxmatch('/is in|is not/i', title);
Maybe a regular expression?
word = prxmatch('/is in|is not/i', title);
I'm pretty sure you can only search for one string using FIND. What you want is something like
FIND(title,"IS IN","i") or FIND(title,"IS NOT","i")
If you have many of these combinations to search for it may be better to create a data set with the target string and then use SQL to find the matches.
data work.find; infile datalines truncover; input find $10.; datalines; Is in is not in one ; run; data work.A; input title $1-39; datalines; A TALE OF TWO CITIES GENERAL MANAGER IN ONE CITY MANAGER IS IN ANOTHER CITY MANAGER IS NOT IN THE CITY run; proc sql; create table matched as select a.*, b.find, find(a.title,strip(b.find),'i') as word from work.a as a, work.find as b; quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.