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

st: Re: RE: RE: -forval- with -inequal7-

From   "Zurab Sajaia" <>
To   <>
Subject   st: Re: RE: RE: -forval- with -inequal7-
Date   Tue, 15 Jul 2008 10:44:57 -0400

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,

----- Original Message ----- From: "Andreas, Peichl" <>
To: <>
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:

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'


Dr. Andreas Peichl
Cologne Center for Public Economics
University of Cologne
Chair Prof. Dr. C. Fuest
50923 Köln (Cologne), Germany
Tel.: +49 (0) 221 470 6201
Fax: +49 (0) 221 470 5060
View my research on my Author page:

* For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index