I am trying to write a macro to create a series of custom tables in SPSS. I used the following macro but it does not work. Any suggestions are highly appreciated. Thanks DEFINE !CustomTabs(!POSITIONAL !TOKENS(1)) *DATASET ACTIVATE PrePostMeasures. CTABLES /VLABELS VARIABLES=location prepost 1! DISPLAY=LABEL /TABLE BY location [C] > prepost [C] BY 1! [S][MEAN F40.2, STDDEV F40.2, COUNT F40.0] /SLABELS POSITION=ROW /CATEGORIES VARIABLES=location prepost ORDER=A KEY=VALUE EMPTY=INCLUDE /TITLES TITLE='Mean and Standard Deviation of var1 by Location and Pre-Post Status'. !ENDDEFINE. !CustomTabs var1. Error Message: Error # 6846 in column 39. Text: ! A macro expression includes an undefined macro variable or a macro operator which is not valid within an expression. Execution of this command stops. Error # 6846 in column 43. Text: ! A macro expression includes an undefined macro variable or a macro operator which is not valid within an expression.
-- |
Administrator
|
Have you tried this?
SET MPRINT ON. !CustomTabs var1. SET MPRINT OFF.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Administrator
|
Houston we have a problem ;-)
Correct usage is NOT 1! it would be !1 . Please refer to the documentation for additional examples.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Administrator
|
Well spotted, Hawkeye! ;-)
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by nuptse
If you are going to create a macro to parameterise the input variable name then you may want to also do so in the CTABLE TITLE, so if the macro is re-used for anything else other than Var1 then the appropriate variable will be indicated in the title.
For which you would use something like this: /TITLES TITLE=!QUOTE(!CONCAT('Mean and Standard Deviation of ', !1, 'by Location and Pre-Post Status')). |
Free forum by Nabble | Edit this page |