Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: Date Formats in Loops

 From Nick Cox To "'statalist@hsphsun2.harvard.edu'" Subject st: RE: Date Formats in Loops Date Wed, 3 Nov 2010 18:53:08 +0000

```Kit already answered, but your search sequence is best as help -- manuals -- FAQs.

Although there a few hundred FAQs at www.stata.com, their main function is to fill in gaps or spell out points that are sometimes misunderstood. Sometimes, where the documentation is detailed and fine, there are no corresponding FAQs.

In this territory, for an introduction, see [U] Working with dates and times. For more
comprehensive treatments, see [D] dates and times and [D] functions.

Nick
n.j.cox@durham.ac.uk

Degas Wright

I have a simple question, on the Time Period title for my regression
results, I would like to show the weekly date format rather than the
number. I have reviewed the FAQ and did not see how to approach this
issue.

local lo=tw(2006w15)
local hi=tw(2010w30)

forvalues i= `lo' / `hi' {
local j=`i'+11
local t1=`i'
local t2= `j'
display _n(3) in white _col(30) ///
"Time period:"  `t1'  "-" `t2'
xtregar (D.(r ep mom))  if date>=`i' & date<=`j' , fe
lbi
post `vector'	(`i') (`j')	(_b[D.ep])  (_b[D.mom])
(_b[_cons])	///
(_se[D.ep]) (_se[D.mom]) (_se[_cons])
local j=`j'+1

}

A example of the results are :

Time period:2629-2640

FE (within) regression with AR(1) disturbances  Number of obs  =     99
Group variable: xticker                         Number of groups =     9

R-sq:  within  = 0.6656                         Obs per group: min =  11
between = 0.0193                                        avg =
11.0
overall = 0.4579

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