Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Generating weighted percentages


From   Rijo John <[email protected]>
To   [email protected]
Subject   Re: st: Generating weighted percentages
Date   Thu, 9 Feb 2006 02:07:09 +0530

> Maybe I misunderstand you, but wouldn't it be easier to create a
> dummy var for ownscar (0 = does not own, 1 = does own) and crosstab
> it with income?  Or, if you prefer, code it 0 and 100, and get the
> mean by income category?

Well, I guess I got the answer (at least easier than what I did before
and I am sure there are much more elegant ways.)

preserve
table income [pw=multiplier], c(n id_var  n car)
gen percentage=table2*100/table1
list income percentage
restore

I have to now learn how to put this into a loop. (Not sure)  Coz I
need to repeat this same exercise for car, TV,.. for some 10-15
items....

Rijo.

*
*   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