[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Ziad El-Khatib" <Ziad.El-Khatib@ki.se> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Egen command |

Date |
Thu, 28 Aug 2008 10:26:05 -0700 |

Dear Eva & Nick, Apologies to reply on For some strange reasons the email ended up in spam box, also found some other email went there. I have worked on it and it went well. Will also try your kind suggestions. Thank you and best regards ziad On Tue, Aug 19, 2008 at 11:09 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote: > Is this copied from a Stata dataset? Or from some spreadsheet or > similar? > > You have five variables here but in most cases only three values are > shown. > > What do the blanks mean? > > Eva's recent post may be what you want. I'm going off-line now. > > Nick > n.j.cox@durham.ac.uk > > Ziad El-Khatib > > Dear Nick, > Thank you. > > Compliance= whether patients did take their drugs within a certain > range rate or not, defined as 95-110% of prescribed drugs on monthly > basis, in this cohort. > > Kindly find below new example with pillcount variable. > > studyid visit pillcount pc2_24 pc36_104 > > 1027 2 0 > 1027 4 0 > 1027 8 0 > 1027 12 0 > 1027 16 0 > 1027 20 0 > 1027 24 0 0 > 1027 36 0 > 1027 52 0 > 1027 78 0 0 > 1029 2 0 > 1029 4 0 > 1029 8 0 > 1029 12 0 > 1029 16 0 > 1029 20 0 > 1029 24 0 0 > 1029 36 0 > 1029 52 0 > 1029 78 1 > 1029 104 0 1 > > > ID 1027 did drop out before week 104 on treatment but still counted her. > ID 1029 has example of patient coming to all visits. > > > > Hope this helps? > Thank you again and best regards > ziad > > > > > > On Tue, Aug 19, 2008 at 10:33 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote: >> You should keep away from -egen, count()-. >> >> What does the help say? >> >> count(exp) (allows by varlist:) creates a constant (within varlist) >> containing the number of nonmissing observations of exp. >> >> Your exp (i.e. expression) is -pillcount-. So you are counting whether >> -pillcount- is non-missing. 1 is non-missing. 0 is non-missing. Any >> other non-missing value is non-missing. All observations with any of >> these non-missing values will be counted. >> >> That is, I gather, not at all what you want. >> >> I am less able to work out precisely what you do want. I could make > some >> guesses but I think it is better if you explain. Do remember that many >> of us are not biostatisticians or medics and so, like me, may be fuzzy >> on what on earth compliance is. >> >> Your examples do not include any with data for the key variable >> -pillcount-. >> >> Nick >> n.j.cox@durham.ac.uk >> >> Ziad El-Khatib >> >> I have cohort dataset monitoring patients' compliance to drugs over 11 >> time points (weeks 2, 4, 8, 12, 16, 20, 24, 36, 52, 78 and 104 after >> starting on drugs). >> I want to look at the persistence of their compliance over weeks 2-24 >> versus 36-104, i.e. OR of not missing any pill at all over all this >> visits between weeks 2-24 versus 36-104. >> >> At every visit I coded pillcount as 0/1: 1 if patient was not >> compliant versus 0: if patient was compliant. >> >> Now trying to create pc2_24 for weeks 2 to 24, and pc36_104 for week >> 36 to 104 to code them as 0/1 (compliant/not compliant). >> >> I tried >> egen pc2_24=count(pillcount),by(studyid), if visit>0&visit<25 >> >> So got >> >> studyid visit pc2_24 >> 1003 2 1 >> 1003 4 1 >> 1003 8 1 >> 1003 12 1 >> 1003 16 1 >> 1003 20 1 >> 1003 24 1 >> 1005 2 1 >> 1005 4 1 >> 1005 8 1 >> >> >> But I want the result to look like: >> studyid visit pc2_24 >> 1003 2 >> 1003 4 >> 1003 8 >> 1003 12 >> 1003 16 >> 1003 20 >> 1003 24 1 >> 1005 2 >> 1005 4 >> 1005 8 >> 1005 12 >> 1005 16 >> 1005 20 >> 1005 24 1 >> >> >> so only to show number 0 or 1 at the last visit, whether visit number >> 24, 20 , or else that is <24 > > * > * 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/ > * * 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/

**Follow-Ups**:**st: merge command doesn't work???***From:*kokootchke <kokootchke@hotmail.com>

**References**:**st: Egen command***From:*"Ziad El-Khatib" <Ziad.El-Khatib@ki.se>

**st: RE: Egen command***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Egen command***From:*"Ziad El-Khatib" <Ziad.El-Khatib@ki.se>

**RE: st: RE: Egen command***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: RE: RE: preserving leading zeros in destring** - Next by Date:
**st: merge command doesn't work???** - Previous by thread:
**RE: st: RE: Egen command** - Next by thread:
**st: merge command doesn't work???** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |