Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: AW: RE: Repeating values


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: AW: RE: Repeating values
Date   Thu, 7 Dec 2006 18:12:03 -0000

OK. 

Have a look at http://www.stata.com/support/faqs/data/dropmiss.html
as it may contain ideas that you can adapt. 

The device of reversing time can be useful (in Stata, that is). 

Nick 
[email protected] 

Thomas Erdmann

> Sorry. I didn't mention that I do not have comprehensive data 
> on the point
> of time when the companies were delisted / taken off the market.
> 
> So basically I have to assume that if the values repeat up to 
> present time,
> that the point where the value is repeated the first time and 
> afterwards
> does not change anymore is the point of the delisting.
 
Nick Cox

> I don't understand the match between your problem 
> and your solution. 
> 
> Sounds to me like 
> 
> replace var1 = . if status == "Delisted" 
> 
> but I'm quite likely misunderstanding. 
 
Thomas Erdmann
  
> > I am working with some variables that or "wrong" in the sense 
> > that if one
> > share was taken off the market (i.e. the company was 
> > dissolved), the last
> > value of the variable is repeated instead of containing 
> > missing values.
> > 
> > e.g.
> > 
> > Status    Year    Var1
> > Listed    1991     0.9 
> > Listed    1992     0.95
> > Listed    1993     0.93
> > Delisted  1994     0.93
> > Delisted  1995     0.93
> > ..
> > Delisted  2006     0.93 (value is always repeated up to 
> present time)
> > 
> > Whereas years 1994-2006 should contain missing values. I came 
> > up with this
> > cleaning process:
> > 
> > 	foreach X of varlist var1 var2 var3 {
> > 	generate `X'new=`X'
> > 	replace `X'new=. if `X'==L.`X'       
> > 	replace `X'=`X'new
> > 	drop `X'new
> > 	}
> > 
> > Which is okay, but also sets the value to missing if one 
> > observation for a
> > listed company repeats, so it also deletes observations that 
> > would be fine.
> > 
> > Any suggestions on how I can only replace the "wrong" values?

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