Statalist


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

st: RE: How to sort out missing data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: How to sort out missing data
Date   Tue, 20 Nov 2007 13:51:35 -0000

I guess at variables -id- and -visit-. 

You can identify patients who did not come every time after 

. bysort id: gen nvisits = _N 

which puts the number of observations for each patient
in a new variable. 

Then 

. levelsof id if nvisits < 10 

will show you patients who did not visit 10 times. 

On your last question, you want in effect to -list- observations not 
present in your data. The data are not "missing"; they are not even 
present. This is possible. 

One way is to -fillin- your data: 

. fillin id visit 
. l if _fillin 

I recommend that you work your way through a basic book 
on Stata. Svend Juul's has lots of medical examples. 

Nick
n.j.cox@durham.ac.uk 

Ziad El-Khatib

Dear STATA lister
I have cohort patients following on visit: 0,2,4,8,12,16,20,24,36&52

When I tab the dataset i see that the total number of patients per visit
is not consistent.

Is it possible to sort out the studyid number of patients who did not
come on every visit?
if yes, would it be possible to find at which visit number?

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