Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Creating missing data


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Creating missing data
Date   Thu, 4 Nov 2004 01:45:27 -0000

Correct. I guess the -egen- should just select those cases. 

. bysort whateverisyourid : gen multiple = _N > 1 
. egen id = group(whateverisyourid) if multiple 
. bysort id (entrytime):
         replace somevar = . if _n == 1 & mod(id,5) == 0

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Keith Dear
> Sent: 04 November 2004 01:36
> To: [email protected]
> Subject: Re: st: RE: Creating missing data
> 
> 
> But celdjt said he wanted to do this for every fifth 
> *multiple-record* 
> case. He could first drop the single-record cases, apply 
> Nick's code, then 
> append them back. Or is there a neater way?
> kd
> 
> At 12:18 PM 4/11/04, you wrote:
> >Suppose your identifiers run 1, 2, ... . If this isn't true,
> >
> >. egen id = group(whateverisyourid)
> >
> >will make it so.
> >
> >Now, if I understand you correctly, you want to
> >
> >. bysort id (entrytime):
> >         replace somevar = . if _n == 1 & mod(id,5) == 0
> >
> >Nick
> >[email protected]
> >
> >[email protected]
> >
> > > My
> > > question is about making an adjustment to the surrogate 
> data set. The
> > > surrogate data set contains about 3500 cases, some of which
> > > have just one
> > > record per case, and others have multiple records. Each 
> record has a
> > > variable recording an entering time and an exit time for 
> that record.
> > > Hence, single record cases have one entry time and one exit
> > > time; multiple
> > > record cases have multiple entry and multiple exit times. I
> > > would like to
> > > convert the first entry time for every fifth multiple-record
> > > case in this
> > > data set into a missing value. Are there any suggestions for
> > > how this might be done.
> >
> >*
> >*   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/
> 
> 
> ==========================================================
> Dr Keith B.G. Dear
> Senior Fellow
> * Centre for Mental Health Research (CMHR)
> * National Centre for Epidemiology and Popn Health (NCEPH)
> 
> The Australian National University
> Canberra ACT 0200 Australia
> T: +61 2 6125 4865 (NCEPH)
> T: +61 2 6125 8439 (CMHR)
> F: +61 2 6125 0740
> 
> CRICOS Provider #00120C
> http://nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
> 
> *
> *   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/
> 

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