| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: FW: st: RE: programming in Stata
Thanks Maarten,Ben and Antoine
It does work now.
best wishes
Ali
Quoting Maarten Buis <[email protected]>:
--- Ali Khashan [mailto:[email protected]] wrote:
The suggested commands work but they are not enough. They do not take into
account that we have different mothers. for example for mother_number
1234567892 newvar will be 40 when it must be missing because this
mother has no previuos child. Is there another code to work only when the
mother_number is repeated.
That is odd, the code I sent you should (and does when I run it on my
computer) take that into account. Can you run the example I send? If
you still
have this problem, could you sent me the output you get? How to run examples
is discussed on http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html#work
*---------------------- begin example ------------
clear
input double mother_number double child_number GA
1234567891 23456789 35
1234567891 23456781 37
1234567891 23456782 40
1234567892 56789012 37
1234567893 56489023 40
1234567894 34567891 40
1234567894 45567890 42
end
bys mother_number (GA): gen prevGA = GA[_n-1]
list
*-------------------- end example -------------------
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/