BookmarkSubscribeRSS Feed
alamrikd
Calcite | Level 5

Hello,

I am using FAERS database for my project. I am trying to select only one drug from the variable "drugname". I used where and if statments but I get error all the time.

 

Here is my code:

libname kete'c:\users\alamrikd\Desktop';
run;


data kete.drug12q4;
infile 'c:\users\alamrikd\Desktop\DRUG13Q1.txt' dlm='$' dsd truncover firstobs=2;
input
primaryid :$10.
caseid :$8.
drug_seq
role_cod :$2.
drugname :$30.
prod_ai :$50.
val_vbm :$1.
route :$10.
dose_vbm :$30.
cum_dose_chr
cum_dose_unit :$7.
dechal :$1.
rechal :$1.
lot_num :$20.
_exp_dt :$10.
@
;
run;

proc contents data = kete.drug12q4;
run;
proc print data=kete.drug12q4(obs=3);

run;

 

data kete.metformin;
set kete.drug12q4;
where drugname = 'metformin';
run;

 

 

I want select only observations for metformin, could you help me how to subset the data based on that?

 

Thank you

1 REPLY 1
andreas_lds
Jade | Level 19

Please post the log of all the steps using "insert code" button.

Are you sure that the value is written in all lowercase?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 361 views
  • 0 likes
  • 2 in conversation