It seems to me that if your concern is with the disappearance of the original variables from the data set, one could generate a new variable equal to the old one, and use collapse with the new variable. The original variable will then still be preserved. David Greenberg, Sociology Department, New York University
----- Original Message -----
From: Nirmala Ravishankar <[email protected]>
Date: Friday, January 17, 2003 0:16 am
Subject: st: Calculating means not using "collapse"
> I am a first-time Stata user, and have a relatively basic
> question. Is
> there some way to calculate the weighted mean and median of a variable
> without using the "collapse" command? As part of a program, I
> need to
> calculate the weighted mean and median to perform other operations
> on the
> dataset, but using "collapse" clears the original variables from the
> workspace. I tried "egen" but that doesn't allow for weighted means.
>
> Here are the specifics: I have household income data for US 1994,
> fromwhich I want to calculate the median income. Then I want to
> disaggregatehouseholds by state and calculate the regional
> medians. Finally, I want to
> calculate the ratio of the regional medians to the national
> median. Using
> "collapse" to calculate the national median removes the original
> observations from the working space.
>
>
> Thanks,
> Nirmala
>
>
>
>
>
> *
> * 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/