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

st: Re: using tsset and "forvalues"


From   "Jan Pettersson" <jan.pettersson@ne.su.se>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: using tsset and "forvalues"
Date   Fri, 5 Mar 2004 16:45:48 +0100

You may disregard this message, sorry for any inconvenience.
/Jan
(who now knows the merits of preserve and postfile...)

----- Original Message ----- 
From: "Jan Pettersson" <jan.pettersson@ne.su.se>
To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, March 05, 2004 11:34 AM
Subject: st: using tsset and "forvalues"


> Hi all.
> Thanks to Scott's helping hand, I now have a data set in long format,
> structured as below.
> However, I would now like to run a xtgls for each id, and I'm not sure how
> to get around the problem with tsset.
>
> The data is structured as:
>
> id    year    eqno
> 1    1975    1
> 1    1976    1
> 1    1975    2
> 1    1976    2
> 2    1975    1
> 2    1976    1
> 2    1975    2
> 2    1976    2
>
> and I would like to perform one regression per id in which eqno is the
panel
> variable and year is the time variable.
>
> forvalues i = 1/2 {
>
> xtgls varlist if id == `i', nocons  p(c)
> }
>
> I realize that it is not possible to make any "local tsset", and running
> forvalues i = 1/2 {
>
> xtgls varlist if id == `i', i(eqno) t(year) nocons  p(c)
> }
> (clearly) does not do it either.
>
> If this is just a stupid RTFM-question, could someone then please give a
> suggestion of where to find it? Any help appreciated.
>
> All best,
> Jan
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index