Statalist


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

generating variable with previous values [was: RE: st: Wald test limit?]


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   generating variable with previous values [was: RE: st: Wald test limit?]
Date   Wed, 6 Feb 2008 17:52:48 -0000

Please read the FAQ on using informative titles, on not replying to 
other threads and on deleting irrelevant material. 

You don't say what your difficulty is. But perhaps this example will
help: 

. bysort mother_id (B_order) : gen prev_infd = infd[_n-1] 

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

Unnati Rani Saha

I am facing difficulties to compute a new variable. I would grateful if
any
of you help me. My data is in long file and I have given below an
example:

Mother's ID		Child's B_date	     B_order	Infant death
1S00005404		6-sep-82			1
1
1S00005404		6-jan-84			2
0
1S00005404		9-jan-87			3
1
1S00005404		14-dec-87			4
1
1S00005404		8-feb-90			5
0
1S00005404		17-jan-99			6
1





© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index