Statalist


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

st: preserving missing values when using total


From   Srini <[email protected]>
To   [email protected]
Subject   st: preserving missing values when using total
Date   Sat, 7 Mar 2009 16:29:49 -0800 (PST)

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/



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