Dear list:
I have a panel dataset with a subject identifier (patid), a time
identifier (week1), and two variables of interest (C4NAIVC and
CD4MEMC), some of which contain missing observations for some
subjects at some time points. I am interested in obtaining, for each
subject, the latest timepoint when either C4NAIVC and CD4MEMC or both
were available.
I tried:
. bysort patid: egen LatestNaive = max(WEEK1) if (C4NAIVC ~=.|CD4MEMC ~=.)
(252 missing values generated)
But this simply produced a missing value in the record that contained
a missing C4NAIVC or CD4MEMC. It still took all week1 values into
account to calculate the maximum. So, if somebody had a missing value
at week 96 but not at week 196, LatestNaive was still 196.
Any suggestions?
*
* 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/