Statalist


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

st: help with bys


From   Ziad El-Khatib <[email protected]>
To   [email protected]
Subject   st: help with bys
Date   Thu, 28 Aug 2008 10:01:42 -0700

Hi!
I am dealing with cohort data for patients followed over different
visits, before starting treatment (coded -1) then on different time
points coded as 0, 2, 4, 8, 12, 20, 24, 36, 52, 78 and 104, also
number 999 will be used if it was an unexpected visit to clinic.

Not all patients came to all visits, so I am using -bys- command
(pasted below) to calculate total number of visits, excluding codes -1
and 999.
The command below is still calculating all visits by living . value if
visit=-1 or visit=999

bys studyid: gen nvisits = _N if visit>=0 &visit<999


Any tips?
Thank you and best regards
ziad

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index