I want to search for list of drugs in oracle database. can I list all the drugs in proc sql in where clause as below?
WHERE (
(A.PRODUCT_DESC_1 CONTAINS ('ARIPIPRAZOLE',' ASENAPINE',BREXPIPRAZOLE)
I got ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, )
Please help
Thanks,
Hi,
proc sql;
select *
from <YOUR_TABLE> A
where A.PRODUCT_DESC_1 in ("ARIPIPRAZOLE","ASENAPINE","BREXPIPRAZOLE");
quit;
CONTAINS doesn't support a list as argument. You need to combine them with OR.
The syntax is incorrect, you need a contains for each argument, definitely a bit cumbersome.
A.PRODUCT_DESC_1 CONTAINS ('ARIPIPRAZOLE')
or CONTAINS ('ASENAPINE')
or ...
Hi,
proc sql;
select *
from <YOUR_TABLE> A
where A.PRODUCT_DESC_1 in ("ARIPIPRAZOLE","ASENAPINE","BREXPIPRAZOLE");
quit;
There are other constructs which may help you:
where XYZ like "*ABC*";
will give you all which contain the string ABC.
No, like is used for pattern matching. Why are you looking for drug names by the way? Should you data not be encoded with WHODrug codes - that is not only safer (you don't miss ones) its simpler as well because you can use higher level terms to bring out groups of related drugs. Also its standard in the industry.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.