|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Re: RE: RE: -forval- with -inequal7-
Hi Lola,
I've just noticed this tread. For similar problems (when you want to
generate inequality measures for subgroups) I wrote -egen- extensions
replication most (or all) indices produced by -inequal7-
try, findit egen_inequal
so once you download it you can simply code:
egen gini = inequal(income), by(date) weights(wei) index(gini)
or even simpler:
egen gini = gini(income), by(date) weights(wei)
Hope this helps,
Zurab
----- Original Message -----
From: "Andreas, Peichl" <[email protected]>
To: <[email protected]>
Sent: Tuesday, July 15, 2008 7:49 AM
Subject: st: RE: RE: -forval- with -inequal7-
Hey Lola,
These do work when limited to 'consecutive' dates (eg 19901/19904), the
>problem arises when they span 'missing' dates as there is no 19905. The
>programme runs and calculates the gini for the dates up until a 'missing'
>date and then stops with an error. This is not a problem with other
>commands using the same dataset, but has arisen with -inequal7-.
The problem is that not all dates exist and inequal7 returns an error
message when you try to use it on a zero obs subsample.
You could follow Nick Cox's advice and have a look at:
http://www.stata.com/support/faqs/data/foreach.html
or use capture to avoid Stata stopping with an error:
g gini=.
qui forval i = 19901/20071 {
capture inequal7 income [fw=wei] if date==`i', returns
replace gini=r(gini) if date==`i'
}
Cheers,
Andreas
-------------------------------------------------
Dr. Andreas Peichl
Cologne Center for Public Economics
University of Cologne
Chair Prof. Dr. C. Fuest
Albertus-Magnus-Platz
50923 K�ln (Cologne), Germany
-------------------------------------------------
Tel.: +49 (0) 221 470 6201
Fax: +49 (0) 221 470 5060
Email: [email protected]
http: www.cpe-cologne.de
http://www.wiso.uni-koeln.de/ASPSamp/fuest/home/index.asp?l=15&wh=peichl.asp&ID_mitarbeiter=6
-------------------------------------------------
View my research on my Author page:
http://ssrn.com/author=678886
http://econpapers.repec.org/RAS/ppe202.htm
-------------------------------------------------
*
* 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/