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:09:03 +0530

Sorry  a slight correction:

> >I want to find the weighted percentage of people owning a car across
> >different income groups. I have an id variable (id_var) for each
> >individual and an indicator variable denoting their income status and
> >another variable denoting their expenditure on car. If the expenditure
> >is 0 it is recorded as missing value and it would mean that the person
> >doesn't own a car.

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) replace
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....

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