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 on April 23, and its replacement, is already up and running.

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

st: RE: RE: RE: RE: RE: RE: RE: RE: RE: Foreach Command in Panel Data

From   "Degas Wright" <>
To   <>
Subject   st: RE: RE: RE: RE: RE: RE: RE: RE: RE: Foreach Command in Panel Data
Date   Wed, 29 Sep 2010 16:54:46 -0400

Unfortunately when I tried moving the if statement I get the following:

. forvalues xticker=1/`r(max)'{
. fcast compute f_ if xticker==`xticker'

if not allowed

Is it possible that the fcast command does not allow if statements? I
understand that you have not used this command before but is there an
alternate way to handle this loop?

Again thanks for your input.

Degas A. Wright, CFA
Chief Investment Officer
Decatur Capital Management, Inc.
250 East Ponce De Leon Avenue, Suite 325
Decatur, Georgia  30030
Voice: 404.270.9838

-----Original Message-----
[] On Behalf Of Nick Cox
Sent: Wednesday, September 29, 2010 11:42 AM
To: ''
Subject: st: RE: RE: RE: RE: RE: RE: RE: RE: Foreach Command in Panel

I have never used -fcast- but I imagine that 

fcast compute f_, step(3) if xticker==`xticker'

should be 

fcast compute f_ if xticker==`xticker', step(3) 

as -if- qualifiers are not options so far as Stata is concerned. 


Degas Wright

Thank you for the reference to 8/05 FAQ and it worked great for
calculating the var for my dataset. A follow on question, I have been
unsuccessful getting the fcast command to work. I have tried
incorporating it into the original forvalue step and doing a separate
forvalue step but neither works.

. forvalues xticker=1/`r(max)'{
.   var r ep mom if xticker==`xticker'

Works fine, however; when I do the following:

. forvalues xticker =1/`r(max)'{
.    fcast compute f_, step(3) if xticker==`xticker'

I get the following error:

Invalid syntax r(198)

I need to perform the var step first and then I can use the fcast
command.  Also, to address your question on collating the results - I
will upload the xtickers, forecasted values (f_r), dates into another
software package to run backtests on how well the forecasted values
perform in a portfolio selection process.

*   For searches and help try:

*   For searches and help try:

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