Statalist


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

Re: st: Listing criteria


From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   Re: st: Listing criteria
Date   Sun, 18 Nov 2007 11:48:26 +0100

Ziad wrote:
 
I have VL level per patient per clinic visit (visits are 4,8,12,16,20,24,36&52)
 
I did score every patient for how many times s/he got high VL (0.yes,
1.no), by this code:

egen thighvl=total(highvl),by(studyid), if select==1
 
i am trying to find a way to have a list of patients who had thighvl>2
including week24, i.e. there should be at least 1 highvl=1 before
visit 24 and highvl=1 by visit 24.
 
------------------------------------------------------------------
 
You have two conditions:
high VL (whatever that is) at one or more of visits 4-20
AND high VL at visit 24. 
VL at visit 36 & 52 is irrelevant.
 
Try this:
 
     * Here I generate a test dataset.
     clear
     set seed 12345
     set obs 100
     gen studyid=_n
     gen select = uniform()<0.8
     expand 6
     sort studyid
     by studyid: gen visit=4*_n
     gen highvl = uniform()<0.5
     ************************************
 
     * Sum of -highvl- for visits 4-20
     gen highvl20=highvl if visit<=20
     egen thighvl20 = total(highvl20) if select==1, by(studyid)
 
     * -highvl- for visit 24
     gen highvl24=highvl if visit==24
     egen thighvl24 = total(highvl24) if select==1, by(studyid)
 
     list if thighvl20>0 & thighvl24>0
 
Hope this helps
Svend
 
________________________________________________________ 
 
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       [email protected] 
_________________________________________________________ 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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