Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "David Radwin" <dradwin@mprinc.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: Thread-Index: AQHNGEBCIuB42jRH6ke3cai302EPyw== |
Date | Wed, 11 Apr 2012 17:37:12 -0700 (PDT) |
Mark, Of course it can be done, although you don't give enough details on your data structure to allow for a specific answer. Generally speaking, you could create a variable to rank days of the week (Wed=1, Tue=2, Thu=3, else=4), -sort- the data by this variable in ascending order, then -collapse- by week using the first observation of the stock price. However, I think a far more reasonable solution, statistically and programming-wise, would be to calculate the mean stock price for the whole week. David -- David Radwin Research Associate MPR Associates, Inc. 2150 Shattuck Ave., Suite 800 Berkeley, CA 94704 Phone: 510-849-4942 Fax: 510-849-0794 www.mprinc.com > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Mark Bailie > Sent: Wednesday, April 11, 2012 5:08 PM > To: statalist@hsphsun2.harvard.edu > Subject: st: Thread-Index: AQHNGEBCIuB42jRH6ke3cai302EPyw== > > Hi, > > I have daily data of stock prices dating back to the 1950s and I would > like to collapse the dataset into weekly data. > > I want the weekly data to be formed from the stock price on every > Wednesday. > > Some weeks do not have a Wednesday, due to the stock markets closed that > day. In these cases I want to use the value from Tuesday for that week. > > Bascially: > > COLLAPSE DAILY TO WEEKLY ON EACH WEDNESDAY -- ALTHOUGH IF THERE IS NO > WEDNESDAY THAT WEEK TAKE THE TUESDAY VALUE -- IF NO TUESDAY, TAKE THE > THURSDAY > > Can this be done? > > Kind regards, > > Mark > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/