[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: new: collapse2
At 16:19 04/08/2004, Dan Blanchette wrote:
How about adding an option to save id variables during the -collapse-?
"Cheating" is probably the way to go, rather than adding a superfluous id()
option. However, I would have typed:
It would be great if you could do this:
. collapse2 (sum) grams kcal fat , by(personid) id(age gender sampwt
because age, gender etc do not vary within a person's set of observations.
I've been cheating -collapse- to get the same result by doing:
. collapse (sum) grams kcal fat , by(age gender sampwt stratum psu personid)
. collapse (sum) grams kcal fat, by(personid age gender samput stratum psu)
. by personid: assert _N==1
That way, I would know that age, gender, samput, stratum and psu really are
id variables for personid (because otherwise Stata would complain and stop).
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Opinions expressed are those of the author, not the institution.
* For searches and help try: