Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Summarising multiple visit data for each individual participant


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: Summarising multiple visit data for each individual participant
Date   Fri, 2 Mar 2012 15:02:06 +0000

... if chrpo[1]== chrpo[2]== chrpo[3]

is legal but it doesn't do what you seem to expect. I think what Stata does is evaluate from left to right, so 

chrpo[1]== chrpo[2]

is evaluated as true (1) or false (0) -- call this <result> 

and then

<result> == chrpo[3] 

is evaluated. Only exceptionally will this coincide with what you want. However, even with the expression 

chrpo if chrpo[1] == chrpo[2] & chrpo[2] == chrpo[3] 

this just copies chrpo for all observations if, and only if, values for the first three observations are identical. 

I think you want either the constant dose, when there is one, 

by ID ( visitno), sort: gen sumabx = chrpo[1] if chrpo[1]== chrpo[2] & chrpo[2] == chrpo[3] 

although clearly [2] or [3] would work as well, or an indicator 

by ID ( visitno), sort: gen constantdose = chrpo[1]== chrpo[2] & chrpo[2] == chrpo[3]

Nick 
[email protected] 

Matthew Hurley

I have patient registry data for which visit data is grouped by patient ID.  At each visit individuals are administered an antibiotic.  I wish to determine if specific antibiotic usage in this dataset is associated with infection in a survival analysis.

I have completed the survival analysis assuming that the antibiotic taken on the first visit represents all antibiotic taken throughout the period, however this assumption is incorrect as antibiotic usage changes on some occasions.

Is there a way I can 'summarise' each individual patients antibiotic use please?  The most pragmatic solution I can think of is to perform a sensitivity analysis for those patients whose antibiotic usage does not change (e.g. for the first 3 visits) to see if this changes my results.

I have tried by generating an indicator variable 'visitno'. 'chrpo' is my categorical variable that reports the antibiotic taken at each visit - generating a 'sumabx' variable that reports the consistently administered antibiotic for each patient.

by ID ( visitno), sort: gen sumabx = chrpo if chrpo[1]== chrpo[2]== chrpo[3] ....however this doesn't work.
I have a separate indicator variable that selects the first visit per patient.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index