Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: Error message using Tabout and regressions by year command


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Error message using Tabout and regressions by year command
Date   Wed, 1 Feb 2012 17:29:24 +0000

Answers below. 

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

Alice Jones

I am currently working with a panel dataset of companies over a period
of 9 years. I need to run regressions on a year-by year basis
including a lag of the independent variable. Using this command in
Stata 11:

"bysort year: regress growth  L.size",

I get this error message:

"r(5) Not sorted".

However, running the same command without a lag in the model works
perfectly. I need help with how to run the regressions as the
inclusion of lags is critical to my analysis.

NJC>>> This looks like a clash between the sorting by year you are asking for and the sorting implied by whatever -tsset- or -xtset- command you issued. You may need to try something like this 

levelsof year, local(years) 

foreach y of local years { 
	regress growth L.size if year == `y' 
} 


Secondly in using the "Tabout" command,entering "Tabout" produces a
table but when entering the following command afterwards to format the
table:

"replace cells(fcount fper fcum) format(%9.0fc %9.1f %9.2f)"

yields this message:

"time-series operators not allowed r(101)"


I xtset the data prior to running Tabout and even tsset again after
getting message first time but still getting same error message.

Is there something wrong with the commands I ran?

NJC>>> These look like options of -tabout- (SSC; please specify where user-written commands you refer to come from). They _must_ be specified with -tabout- and cannot be specified retrospectively. Stata is probably guessing that you want a -replace- command but cannot make sense of what you type as such. 



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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index