Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: ineqdeco, loops and missing values
From
emmmasa <[email protected]>
To
[email protected]
Subject
Re: st: RE: ineqdeco, loops and missing values
Date
Sat, 26 Jun 2010 08:22:33 -0700 (PDT)
Thank you - that's very helpful.
And thanks regarding the excess code - i merged two programs and haven't edited carefully!
Best
Emma
--- On Sat, 6/26/10, Martin Weiss <[email protected]> wrote:
> From: Martin Weiss <[email protected]>
> Subject: st: RE: ineqdeco, loops and missing values
> To: [email protected]
> Date: Saturday, June 26, 2010, 9:59 AM
>
>
> <>
>
> BTW, Emma, your second line looks redundant as the -local-
> "levels" already
> exists. Why would you want another one with the same
> content?
>
>
> ***********
>
> clear*
>
> inp str20 country
> "Germany"
> "Japan"
> "United States"
> "France"
> "Canada"
> "Australia"
> end
>
> levelsof country, local(levels)
> local ctries "`r(levels)'"
>
> ma di
> ***********
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of emmmasa
> Sent: Samstag, 26. Juni 2010 15:38
> To: [email protected]
> 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.
> Emma
>
>
> 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:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/