replace dummy = dummy[_n-1] if dummy >= .
Joseph Coveney
----------------------------------------------------------------------------
z-da wrote:
>Is there an easy way of implementing the following task in STATA? (It
>sounds a very easy task, but it goes beyond my limited knowledge of STATA.)
>
>Say, I have a data series with two variables: date, dummy
>
>date dummy
>1/1/03 1
>1/2/03 .
>1/3/03 3
>1/4/03 .
>1/5/03 .
>1/7/03 2
>1/8/03 .
>1/9/03 .
>1/10/03 .
>1/11/03 4
>1/12/03 .
>1/13/03 .
>.......
>
>I just want to fill the missing value, using the previous value until it
>changes (or the last-observation-carried-forward method), ie, to get
>
>date dummy
>1/1/03 1
>1/2/03 1
>1/3/03 3
>1/4/03 3
>1/5/03 3
>1/7/03 2
>1/8/03 2
>1/9/03 2
>1/10/03 2
>1/11/03 4
>1/12/03 4
>1/13/03 4
>.......
>
>
>
>
*
* 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/