Statalist


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

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


From   "Andreas, Peichl" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: -forval- with -inequal7-
Date   Tue, 15 Jul 2008 13:49:52 +0200

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/



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