Hi all,
I am doing a time-series analysis of the S&P500, and I have imported all of my variables in from excel. I am having trouble converting the date variable from excel into business calendar form while still retaining the accurate dates.
Thus far, I have performed the commands (as per STATA's link http://www.stata.com/bookstore/stata12/pdf/d_datetime_business_calendars.pdf ):
generate _date = date(date, "MDY")
format _date %td
drop date
generate mydate = bofd("simple", _date)
format mydate %tbsimple
When I say "list mydate", however, all the values show as "."
I also emailed STATA tech support, but there seems like an easier way to complete my goals. Their recommendations included opening the do-file editor, entering
version 12
dateformat dmy
range 20jul2007 19jul2012
centerdate 20jul2007
omit dayofweek (Sa Su)
omit date 1jan*
omit dowinmonth +2 Mo of jan
saving this to the PERSONAL directory, reopening the do-file editor, and running this final program:
clear all
set obs 362
generate day=mdy(01,04,2010)+_n-1
format day %td
generate mydate = bofd("mybcal",day)
format mydate %tbmybcal
list in 1/30
bcal de mybcal
tsset mydate
generate x=int(uniform()*20)
generate lx=l.x
list in 1/30
.. But this didn't seem to work (or I could not figure it out). Any thoughts?
I am relatively inexperienced when it comes to STATA, and even more inexperienced when it comes to time-series analysis, so any help is greatly appreciated.
Thanks for any insight!
R
I am doing a time-series analysis of the S&P500, and I have imported all of my variables in from excel. I am having trouble converting the date variable from excel into business calendar form while still retaining the accurate dates.
Thus far, I have performed the commands (as per STATA's link http://www.stata.com/bookstore/stata12/pdf/d_datetime_business_calendars.pdf ):
generate _date = date(date, "MDY")
format _date %td
drop date
generate mydate = bofd("simple", _date)
format mydate %tbsimple
When I say "list mydate", however, all the values show as "."
I also emailed STATA tech support, but there seems like an easier way to complete my goals. Their recommendations included opening the do-file editor, entering
version 12
dateformat dmy
range 20jul2007 19jul2012
centerdate 20jul2007
omit dayofweek (Sa Su)
omit date 1jan*
omit dowinmonth +2 Mo of jan
saving this to the PERSONAL directory, reopening the do-file editor, and running this final program:
clear all
set obs 362
generate day=mdy(01,04,2010)+_n-1
format day %td
generate mydate = bofd("mybcal",day)
format mydate %tbmybcal
list in 1/30
bcal de mybcal
tsset mydate
generate x=int(uniform()*20)
generate lx=l.x
list in 1/30
.. But this didn't seem to work (or I could not figure it out). Any thoughts?
I am relatively inexperienced when it comes to STATA, and even more inexperienced when it comes to time-series analysis, so any help is greatly appreciated.
Thanks for any insight!
R