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

st: RE: How to insert new observation?


From   "Ronnie Babigumira" <[email protected]>
To   <[email protected]>
Subject   st: RE: How to insert new observation?
Date   Tue, 18 Feb 2003 21:27:26 +0100

Hi Hailing
My reading into your question, you have a string variable var1 in this
format
var1
08/01/2001 --Wed
08/02/2001 --Thu
08/03/2001 --Fri
08/05/2001 --Mon

and you would like to extract the first part which is the date. To do this,
you can use

gen str18 bdate = substr(var1, 1, 10)
compress

This should help you extract the first part from your variable into a new
variable bdate. That having been said, you might wanna consider formating
the new variable using statas date functions.

Ronnie

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Zang Hailing
Sent: 18. februar 2003 21:01
To: [email protected]
Subject: st: How to insert new observation?


Hi,
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?

Thanks a lot!
Hailing




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