Maybe something like
g b=.
g se=.
forv i=1/8 {
loc q: di %tqYY!_q `i'+139
replace b=_b[_ItreXyea`q'] in `i'
replace se=_se[_ItreXyea`q'] in `i'
}
will work for you. Have a look at
help dates_and_times##formatting
and
help extended_fcn
for details.
On Jan 17, 2008 4:41 PM, Davide Cantoni <[email protected]> wrote:
> Thank you, Maarten and Austin, for your most beautiful codes.
>
> One more question about Austin's suggestion. Re: your lines:
>
> *------------------ begin example -----------------
> g b=.
> g se=.
> forv i=1/13 {
> replace b=_b[unionXlev`i'] in `i'
> replace se=_se[unionXlev`i'] in `i'
> }
> *-------------------- end example -------------------------
>
> How would I proceed if my interaction terms are not indexed with a
> final figure 1 to N? In my case, they are indexed by quarters 95_1
> 95_2... etc. To make it clearer: of course the following does not
> work:
>
> *------------------ begin example -----------------
> g b=.
> g se=.
> foreach i in 95_1 95_2 95_3 95_4 96_1 96_2 96_3 96_4 {
> replace b=_b[_ItreXyea`i'] in `i'
> replace se=_se[_ItreXyea`i'] in `i'
> }
> *-------------------- end example -------------------------
>
> What would you suggest?
>
*
* 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/