Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: select if statements in Stata


From   David Greenberg <[email protected]>
To   [email protected]
Subject   st: select if statements in Stata
Date   Tue, 13 Jan 2004 16:22:37 -0500

This example illustrates how it is done. David

----- Original Message -----
From: Joseph Coveney <[email protected]>
Date: Monday, January 12, 2004 10:58 pm
Subject: Re: st: How do I fill in missing values using last-observation-carried-fo

> 
> 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/
> 

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index