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: copying last reported value
From
Christopher Baum <[email protected]>
To
<[email protected]>
Subject
re: st: copying last reported value
Date
Sat, 19 Feb 2011 13:23:55 -0500
<>
. g var4 = .
(20 missing values generated)
. bys var2 (var1): replace var4 = cond(mi(var3), var4[_n-1], var3)
(17 real changes made)
. l
+---------------------------+
| var1 var2 var3 var4 |
|---------------------------|
1. | 1 1 . . |
2. | 2 1 .2 .2 |
3. | 3 1 . .2 |
4. | 4 1 . .2 |
5. | 5 1 . .2 |
|---------------------------|
6. | 6 1 . .2 |
7. | 7 1 . .2 |
8. | 8 1 .3 .3 |
9. | 9 1 . .3 |
10. | 10 1 . .3 |
|---------------------------|
11. | 1 2 . . |
12. | 2 2 . . |
13. | 3 2 .1 .1 |
14. | 4 2 . .1 |
15. | 5 2 . .1 |
|---------------------------|
16. | 6 2 . .1 |
17. | 7 2 .5 .5 |
18. | 8 2 . .5 |
19. | 9 2 . .5 |
20. | 10 2 . .5 |
+---------------------------+
.
Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
*
* 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/