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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: How can I replace missing values with the variable's first nonmissing value?


From   xueliansharon <xuelianstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: How can I replace missing values with the variable's first nonmissing value?
Date   Sat, 11 Aug 2012 08:16:34 -0700 (PDT)

Dear all,

I want to replace a variable's missing value with its first nonmissing
value, how can I realize this? I read the FAQ at
http://www.stata.com/support/faqs/data-management/replacing-missing-values/,
but there is no example for my case.

My data structure is like :

_n  myvar
1    .
2    .
3    .
4    1
5    2
6    6
7    .

After replacement, I want to get data as:

_n  myvar
1    1
2    1
3    1
4    1
5    2
6    6
7    1

Thank you.

Best,
Sharon



--
View this message in context: http://statalist.1588530.n2.nabble.com/How-can-I-replace-missing-values-with-the-variable-s-first-nonmissing-value-tp7580235.html
Sent from the Statalist mailing list archive at Nabble.com.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index