Dear all
Consider the following three identical variables to start with:
var1 var2 var3
. . .
. . .
. . .
2 2 2
3 3 3
4 4 4
. . .
. . .
. . .
Typing
. replace var2=var2[_n-1] if var2==. & _n>1
. replace var3=var3[_n+1] if var3==. & _n<_N
results in
var1 var2 var3
. . .
. . .
. . 2
2 2 2
3 3 3
4 4 4
. 4 .
. 4 .
. 4 .
Why does Stata replace all three missings in the first case but only the
first missing in the second case? Do I have to sort the dataset the
other way around in order to fill var3 in a similar way as var2 or is
there an easy workaround?
Thanks a lot.
Best,
Daniel
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/