id drug v_date
1 11 01/02/2004
1 11 03/03/2005
1 11 8/3/2005
1 22 5/4/2005
1 22 6/6/2005
Hi All,
I have something similar with the above database. Multiple drugs per id and the same drug can have more than one v_date. My question I want to find the number of patients who obtained at least one drug (for example at least 1 of drug number 11) . So if I have 10 patient who had at least one of drug (no 11) in different v_date, I want to obtain an output that state: drug 11 frequency= 10, and so on
Hi @lillymaginta,
Try this:
proc sql;
create table want as
select drug, count(distinct id) as frequency
from have
group by drug;
quit;
Hi @lillymaginta,
Try this:
proc sql;
create table want as
select drug, count(distinct id) as frequency
from have
group by drug;
quit;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: