Help using Base SAS procedures

classifying adverse events by visits

Reply
Super Contributor
Posts: 301

classifying adverse events by visits

Hi guys, I need to classify the 6 adverse events (3 adverse events by subjid)  in the variable visit,

any help? Example...the first adverse event of subject 1 (02jan2008)...will correspond visit=1, and, the last visit of subject 1 (03jun2008) will correpond visit=. , and so on...

I need to classify the 6 adverse events.

It is a simple example...I got 500 subjects..thanks in advance.

V.

data drug;

length subjid visit start stop 8;

input @1 SUBJID @4 VISIT @6 START DATE9. @16 STOP DATE9.; 

format start stop date9.;

datalines;

1  1 01JAN2008 15JAN2008      

1  2 16jan2008 30jan2008    

1  3 01feb2008 15feb2008        

1  4 16feb2008 28feb2008

1  5 01mar2008 15mar2008

1  6 16mar2008 30mar2008

2  1 05jan2009 15jan2009    

2  2 16jan2009 25jan2009   

2  3 05feb2009 15feb2009      

2  4 16feb2009 25feb2009

2  5 05mar2009 15mar2009

2  6 16mar2009 25mar2009

;

RUN;

DATA AE;

LENGTH SUBJID ADVERSE 8;

INPUT @1 SUBJID @3 ADVERSE DATE9.;

FORMAT ADVERSE DATE9.;

DATALINES;

1 02jan2008

1 24feb2008

1 03jun2008

2 01jan2009

2 05feb2009

2 15mar2009

;

RUN;

Super User
Posts: 19,877

Re: classifying adverse events by visits

proc sql;

create table want as

select ae.id, ae.adverse, d.visit

from ae

left join drug d

ae.subjid=d.subjid

and ae.adverse between d.start_date and d.stop_date;

quit;

Ask a Question
Discussion stats
  • 1 reply
  • 130 views
  • 0 likes
  • 2 in conversation