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]

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


From   xueliansharon <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index