I was wondering if there is a way using the count command to
automatically count the number of variables inputted in the macro and
then fill in the number needed.
The macro call is like this, where users put in outcome variables,
predictor variables (as many as wished), and then they need to specify
the number of x's.
REGS y = dv /x = iv /n = nums.
***Then long macro goes here****.
I tried to count the x's using something like this (which I found at
http://web.uvic.ca/~cass/spss-macros.html):
DEFINE @CNTVAR@ (@VARS@ !ENCLOSE('(',')') / @CNTVR@ !TOKENS(1) )
COUNT !@CNTVR@ =!@VARS@ (LO THRU HI,MISSING).
!ENDDEFINE .
@CNTVAR@ @VARS@ ( A B C ) @CNTVR@=N_ABC .
FREQ N_ABC .
But I don't know how to feed something like this back into the macro
specification.
My only solution might be to rebuild the macro so that it doesn't need
the number directly inputted, but it would be sweet if I could just
count the inputs, store that number in a macro variable, and then put
that into the macro call.
Any help or comment is appreciated.
Felize
I think I would re-write the macro so that it doesn't need the number
of explanatory variables passed to it. Does this do what you want?
define REGS (y = !tokens(1) / x = !CMDEND)
REGRESSION
/MISSING LISTWISE
/STATISTICS COEFF OUTS CI(95) R ANOVA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT !Y
/METHOD=ENTER !X.
!enddefine.
REGS y = DV x = x1 .
REGS y = DV x = x1 x2 .
REGS y = DV x = x1 x2 x3 .
--
Bruce Weaver
bwe...@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/Home
"When all else fails, RTFM."
So presumably your macro does more than just run a regression model.
What else does it do, and do any of those other things require the
count of explanatory variables? Is it a linear regression model, or
some other kind of regression? If you give a bit more detail, perhaps
someone can provide a little more help.