Thanks.
* Curve Estimation.
TSET MXNEWVAR=1.
PREDICT THRU 30.
CURVEFIT
/VARIABLES=VAR1
/CONSTANT
/MODEL=LINEAR
/PLOT FIT
/SAVE=PRED .
I don't have SPSS on this machine, so the following is untested.
* Put the syntax inside a macro that takes a list of variables .
DEFINE !MYFIT (VLIST = !CMDEND )
!DO !V !IN (!VLIST)
* Curve Estimation.
TSET MXNEWVAR=1.
PREDICT THRU 30.
CURVEFIT
/VARIABLES=!V
/CONSTANT
/MODEL=LINEAR
/PLOT FIT
/SAVE=PRED .
!DOEND
!ENDDEFINE.
* Now call the macro .
set mprint on . /* at least while testing the macro .
!MYFIT v = var1 var2 var3 .
set mprint off.
There may be a limit on the number of variables that you can hand
to the macro in one go. If there is, just split up the variables
into a few lists, and call it more than once.
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
I am just not getting this, where do I define my list of variables or
more importantly how do I define them "var1 to var154"? Evidently the
"To" is a no no.
Thanks,
AH
In that version of the macro, you have to hand the macro the
variables. But if you want "var1 to var154", a different approach
would be better. Something like the following should work. But
again, bear in mind I don't have SPSS on this machine to test it.
DEFINE !MYFIT ()
!DO !I = 1 !TO 154
* Curve Estimation.
TSET MXNEWVAR=1.
PREDICT THRU 30.
CURVEFIT
/VARIABLES= !CONCAT("Var",!I)
/CONSTANT
/MODEL=LINEAR
/PLOT FIT
/SAVE=PRED .
!DOEND
!ENDDEFINE.
* Call the macro.
!MYFIT.
--
Bruce Weaver
bwe...@lakeheadu.ca
I don't think a macro here--just specify the variables on the CURVEFIT
command where one can use the TO command. Note that there may be a
limit on the number of variables allowed. In that case, just use more
than one CURVEFIT command.
> I don't think a macro here--just specify the variables on the CURVEFIT
> command where one can use the TO command. Note that there may be a
> limit on the number of variables allowed. In that case, just use more
> than one CURVEFIT command.
I'm back on a machine that has SPSS, and can confirm that CURVEFIT
will take more than one variable using TO as a keyword. Thanks for
the heads-up ViAnn. I can't find anything in the syntax chart or the
examples that show this explicitly though, nor can I find anything
saying whether there is a limit on the number of variables. So I
guess it's an empirical question for the OP--try it and see what
happens. ;-)
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
Mr. Weaver's macro is still cool. But knowing that "TO" would have
worked would have saved much, in any event "props" to Mr. Weaver and
VAB. Although, the "TO" works, if you want a forecast a period or two
into the future, it appears you need to change the "TSET MXNEWVAR=1."
statement from 1 to however many variables you want to "Curvefit"
on.