Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: sroot user written pgm


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: sroot user written pgm
Date   Mon, 4 Nov 2013 10:57:30 +0000

You are asked in the Statalist FAQ (a) to explain where user-written
programs you refer to come from (b) not to send attachments to the
list.

With your data, -tsset gvkey obsno, quarterly- fails because -gvkey- is string.

You would be better using a proper quarterly date:

gen date = yq(year, fqtr)
tsset id date

But your main problem appears to be that -sroot- (SJ) does not support
-if- correctly.  You should contact the author.

A work around is this:

egen id = group(gvkey), label
gen date = yq(year, fqtr)
tsset id date

su id, meanonly

forval i = 1/`r(max)' {
             preserve
             keep if id == `i'
             sroot fcf
             preserve
}

Nick
[email protected]


On 4 November 2013 03:28, Francis, Richard N <[email protected]> wrote:

> Anyone know if a user written program such as "sroot" (seasonal unit root test) is capable of looping such that the program tests the time series for each subject in the sample?
>
> I attached a sample with three subjects, 60 obs each.
>
> Then used the following pgm:
>
> tsset gvkey obsno, quarterly
>
> egen id = group(gvkey)
> su id, meanonly
>
> foreach i of num 1/`r(max)' {
> sroot fcf if id == `i'
> }
>
> Program runs, but pools the subjects rather than test them individually.
>
> I am grateful for any ideas here.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index