Bookmark and Share

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: weight


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: RE: weight
Date   Wed, 12 Oct 2011 14:42:37 +0100

Looking at your question again, I can't make much sense out of what you want. According to your sample data, -indicator- is things like "FDI Inflows in current USD millions". You should be explaining in what sense that could ever be 10. Presumably there is a value label somewhere. 

A different comment is that your data structure is a lousy one for doing anything serious in Stata. You need some sort of -reshape long-. 

That said, you can do something like this: 

egen value10 = total((indicator == 10) * value), by(country) 

Nick 
[email protected] 

Abu Camara

You are right the instruction is not the right one. Any other way of
getting what I want.


On 12 October 2011 16:24, Nick Cox <[email protected]> wrote:

> Your instructions leave you with no observations with non-zero weights.
>
> The condition -if indicator == 4- selects only those observations for which -indicator- is 4. Conversely, all observations with any other value of -indicator-, 10 or anything else not 4, will be excluded.
>
> It follows that for those observations selected the expression -indicator == 10- will always be logically false and so numerically equal to 0 and so will the aweights be.
>
> Nick
> [email protected]
>
> Abu Camara
>
> I am tabulating using the following command but the variable
> "indicator" whose code correspond to
> for example "10" is my weight. So the command should use values of the
> variable "value" that correspond to indicator==10  as my weight.
> But I get no output and my output is in fact "no observation". Any
> help would be appreciated.
>
> **--command-----.
> table  rda  year [aweight=indicator==10] if  indicator==4, c(mean  value) row
>
>
> **-------sample data------------------.
> id    country    indicator    year    region    ecog    oil    value
> 11990    Afghanistan    FDI Inflows in current USD millions    1990
> ASIA-8    LDMC-25    Non-Oil-34
> 11990    Afghanistan    Net trade in goods and services (BoP, % of
> GDP)    1990    ASIA-8    LDMC-25    Non-Oil-34
> 11990    Afghanistan    Revenue, excluding grants (% of GDP)    1990
>  ASIA-8    LDMC-25    Non-Oil-34
> 11990    Afghanistan    External debt stocks, total (DOD, % of GDP)
> 1990    ASIA-8    LDMC-25    Non-Oil-34
> 11990    Afghanistan    ODA Commitments (All Donors), in current USD
> millions    1990    ASIA-8    LDMC-25    Non-Oil-34    164.63
> 11990    Afghanistan    Net trade in goods and services (BoP, current
> US$)    1990    ASIA-8    LDMC-25    Non-Oil-34
> 11990    Afghanistan    Cash surplus/deficit (% of GDP)    1990
> ASIA-8    LDMC-25    Non-Oil-34
>
>
> *
> *   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/
>



-- 
Best Wishes,

Abu Camara

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index