Using macro value in custom table

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

espss
Posts: 1
Joined: Fri May 25, 2012 10:33 am

Using macro value in custom table

Postby espss » Fri May 25, 2012 10:59 am

I have a python script that generates a list of variable according tot variable name (qs1, qs2, etc.) and subsequently sets a macro value (!varlist in this case) for this list. I want to use the macro value to generate a custom table. My code is now as follows:

CTABLES
/VLABELS VARIABLES=!varlist DISPLAY=DEFAULT
/TABLE !varlist [TABLEPCT.COUNT PCT5.0]
/SLABELS VISIBLE=NO
/CLABELS ROWLABELS=OPPOSITE
/CATEGORIES VARIABLES=!varlist ORDER=A KEY=VALUE EMPTY=EXCLUDE.



The problem in the command is in the bold part. Execution of this command ends in the following warning:

TABLE: Text qs2. An invalid subcommand, keyword, or option was specified. Execution of this command stops.



If I change the bold part as follow, the code works, but the whole advantage of the macro value is lost:

CTABLES
/VLABELS VARIABLES=!varlist DISPLAY=DEFAULT
/TABLE qs1 [TABLEPCT.COUNT PCT5.0] + qs2 [TABLEPCT.COUNT PCT5.0] + etc.
/SLABELS VISIBLE=NO
/CLABELS ROWLABELS=OPPOSITE
/CATEGORIES VARIABLES=!varlist ORDER=A KEY=VALUE EMPTY=EXCLUDE.


Tried a lot of different things and searched the internet for two days now. So my question: can anyone tell me how to use the macro value properly in a ctables command?
Thanks a million!

Elmer

Who is online

Users browsing this forum: No registered users and 2 guests

cron