Statalist


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

st: RE: Code to generate variable indicating date that CD4 drops below 250


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Code to generate variable indicating date that CD4 drops below 250
Date   Wed, 1 Apr 2009 14:32:24 +0100

Answers to this included a direct approach looping over variables and an
indirect approach based on a prior -reshape long-. Everyone is right:
Chelsea's problem is easily soluble with the data structure Chelsea has,
but a different data structure is advisable nevertheless. 

In addition, a generic discussion of what have been called "rowwise"
problems was given in 

SJ-9-1  pr0046  . . . . . . . . . . . . . . . . . . .  Speaking Stata:
Rowwise
        (help rowsort, rowranks if installed) . . . . . . . . . . .  N.
J. Cox
        Q1/09   SJ 9(1):137--157
        shows how to exploit functions, egen functions, and Mata
        for working rowwise; rowsort and rowranks are introduced

The versions of -rowsort- and -rowranks- released with this article (and
thus available via the Stata Journal website) supersede those on SSC,
but require Stata 9 at least. The versions on SSC remain accessible,
frozen as was, for the same of those on Stata <9. 

Nick 
[email protected] 

Polis, Chelsea B.

I would like to create a variable in my dataset to indicate the date at
which a subjects CD4 counts dropped below 250.  My data is currently in
wide format, and each subject had anywhere from 1 to 19 visits.  For
each
subject, I have up to 19 variables that indicate cd4 count (i.e., cd41
cd42
cd43 cd44 and so on), and up to 19 variables that indicate visit  date
(visitdate1 visitdate2 visitdate3 visitdate4 etc.).  I'd like to create
a
variable to indicate the first date at which CD4 count dropped below
250,
if it ever dropped below 250.

*
*   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