Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: ineqdeco, loops and missing values

From   "Martin Weiss" <>
To   <>
Subject   st: RE: ineqdeco, loops and missing values
Date   Sat, 26 Jun 2010 15:51:20 +0200


Put -capture- in front of the relevant command.


-----Original Message-----
[] On Behalf Of emmmasa
Sent: Samstag, 26. Juni 2010 15:38
Subject: st: ineqdeco, loops and missing values

Dear all:
I would like to run a couple of loops using ineqdeco on a large dataset - to
compute inequality for various variables by country (please see below).
Some countries do not have data for particular variables - and the program 
ends abruptly ever time it encounters such a case ("no observations").
Is it possible to amend my program so that ineqdeco skips over such cases?
I'd be grateful for any advice.
Many thanks.

levelsof country, local(levels)
local ctries "`r(levels)'"
foreach var of varlist var_1-var_10 {
      foreach ctr in `ctries'{
      ineqdec0 `var'[w=weight] if `"`ctr'"'==country //& var!=.
      replace Country_gini_`var'=r(gini) if `"`ctr'"'==country

*   For searches and help try:

*   For searches and help try:

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