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

Re: st: Re: Questions on Stata


From   Ernest Berkhout <[email protected]>
To   [email protected]
Subject   Re: st: Re: Questions on Stata
Date   Mon, 13 Dec 2004 14:33:49 +0100

At 13:58 13/12/2004, you wrote:
Sorry, please ignored the previous message about var4

egen var4 = group(var2)
bysort var2 : gen var5 = _n
Still not generally applicable!
First, one should start by using informative variable names, so that 'var2' would become 'age'. This makes problems more straightforward, the current problem appears immediately: what is two persons have the same age?

The original poster should better examine the possibilities of -generate- in combination with explicit subsscripting. If it is the case (and only then!) that every person in the dataset had 3 records and they are stored directly on top of eachother, than you can generate a person-identifier (variable 'personid') and some individual counter (variable 'time'):

gen id = ceil(_n/3)
bysort id: gen time = _n

However, this is a dangerous practice imho. How can one be sure that each person is measured exactly 3 times, and that there are no missing observations? Why is there no id-variable already included?


Ernest Berkhout
SEO Amsterdam Economics
University of Amsterdam
******************************************************
For information on flexwork & research: www.tempworkresearch.nl ******************************************************
Room 3.08
Roetersstraat 29
1018 WB Amsterdam
The Netherlands

tel.:+ 31 20 525 1657
fax:+ 31 20 525 1686
http://www.seo.nl
===========================
A statistician: someone who insists
on being certain about uncertainty
===========================
*
* 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