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

RE: st: How to insert new observation?


From   amcdowell@stata.com
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: How to insert new observation?
Date   Tue, 18 Feb 2003 15:39:24 -0600

Zang Hailing wrote:

> I am trying to insert new observations into the existing data file. For
> example, the trading days are only weekdays, namely Monday through Friday.
> But I also wish to list Sat and Sun in the data file. (So only date appears,
> other columns will be blank because of no data.)
>
> for example:
> 08/01/2001 --Wed
> 08/02/2001 --Thu
> 08/03/2001 --Fri
> 08/05/2001 --Mon
>
> I wish to have 08/04/2001 and 08/05/2001 appears to be able to merge with
> other data sets. How can I do that?

If you convert your date variable to a Stata elapsed date, then you can
-tsset- your data. Once the data has been -tsset-, you can use -tsfill-; it
will insert observations into the dataset for all of the gaps in the time
series.


Allen McDowell
amcdowell@stata.com

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index