[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: new: collapse2
How about adding an option to save id variables during the -collapse-?
It would be great if you could do this:
. collapse2 (sum) grams kcal fat , by(personid) id(age gender sampwt stratum psu)
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)
Applications Analyst Programmer
Carolina Population Center UNC-CH
>From "David Roodman" <DRoodman@cgdev.org>
>Subject st: new: collapse2
>Date Tue, 3 Aug 2004 20:50:43 -0400
>I've just released an augented version of Stata's collapse command, called collapse2. The only change is that there are now four new "aggregation" operators:
>first -- first observation in group
>last -- last
>firstnm -- first non-missing
>lastnm -- last non-missing
>Data must be tsset to use the operators. I find these convenient for example for converting a panel data set with annual observations to one with decadal observations where I need such variables as initial
>GDP and initial population.
>To install, type "ssc install collapse2". Comments welcome.
>Center for Global Development
* For searches and help try: