Statalist


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

Re: st: AW: preserving missing values when using total


From   Srini <[email protected]>
To   [email protected]
Subject   Re: st: AW: preserving missing values when using total
Date   Sun, 8 Mar 2009 11:54:05 -0700 (PDT)

Hi Martin,

STATA is giving me an error saying that I'm not allowed to use the option missing with egen/total.

I'm using version 10 - is there another command I can try?

Thanks,

Sinduja

--- On Sun, 3/8/09, Martin Weiss <[email protected]> wrote:

> From: Martin Weiss <[email protected]>
> Subject: st: AW: preserving missing values when using total
> To: [email protected]
> Date: Sunday, March 8, 2009, 10:53 AM
> 
> <> 
> 
> 
> 
> *************
> by year, sort : egen float accounts_total =
> total(accounts), missing
> *************
> 
> 
> 
> HTH
> Martin
> 
> -----Ursprüngliche Nachricht-----
> Von: [email protected]
> [mailto:[email protected]]
> Im Auftrag von Srini
> Gesendet: Sonntag, 8. März 2009 01:30
> An: [email protected]
> Betreff: st: preserving missing values when using total
> 
> Hi,
> 
> After data manipulation, I have a data set with multiple
> observations per
> year. I used total to sum over these observations to get
> collapse the data,
> but realized that the process was replacing missing values
> with zeroes.
> 
>             year   
> accounts       accounts_total
> district 1  72     
>    .           
>      0
> district 1  72     
>    .           
>      0
> district 1  72     
>    .           
>      0
> district 1  72     
>    .           
>      0
> district 1  73     
>    .           
>      0
> district 1  73     
>    .           
>      0
> district 1  73     
>    .           
>      0
> district 1  74        10 
>            
>    34
> district 1  74        20 
>            
>    34
> district 1  74     
>    4           
>      34
> district 1  75     
>    15         
>       32
> district 1  75     
>    17         
>       32
> 
> In my case, accounts data is missing for the first few
> years. How can I
> ensure that when I take the total by year, accounts_total =
> . for year = 72
> and year = 73? Currently, STATA has accounts_total = 0 for
> those years.
> 
> If there isn't a specific command, I can try and use the
> method suggested by
> Nick Cox in 2005 in this thread: Egen functions -
> preserving missing values?
> 
> Thanks.
> 
> Sinduja
> 
> 
>       
> 
> *
> *   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/



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