|
Hi all,
Just wondering if there is a way to loop through variables using ctables? I want to run ctables for a series of variables: CTABLES /VLABELS VARIABLES=dept1 q2 DISPLAY=DEFAULT /TABLE dept1 [C] BY q2 [C][ROWPCT.COUNT PCT40.1, TOTALS[COUNT F40.0]] /CATEGORIES VARIABLES=dept1 ORDER=A KEY=VALUE EMPTY=INCLUDE /CATEGORIES VARIABLES=q2 [1, 2, 3] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. When I try to do a do repeat for q2 q3 q4a..., it fails. Is there a way to assign a set of variables such that I can repeatedly run the ctables command above? Thanks so much! best, Govind -- - Govind Acharya Assistant Director/Senior Research Associate Survey Research Institute, Cornell University 391 Pine Tree Rd. Ithaca, NY 14850 phone: (607) 255-0375; fax: (607) 255-7118 http://www.sri.cornell.edu ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Govind,
I am not sure if CTABLES is allowed within the DO REPEAT-END REPEAT command. Try the List-Processing Loop. The discussion is on page 562 of the Command Syntax Reference (version 16) under the DEFINE-ENDDEFINE command. Use the first example in the List-Processing Loop section as guide. Based on that example, try this command. define govind (!pos !charend('/')). !do !i !in (!1). CTABLES /VLABELS VARIABLES=dept1 !i DISPLAY=DEFAULT /TABLE dept1 [C] BY !i [C][ROWPCT.COUNT PCT40.1, TOTALS[COUNT F40.0]] /CATEGORIES VARIABLES=dept1 ORDER=A KEY=VALUE EMPTY=INCLUDE /CATEGORIES VARIABLES=!i [1, 2, 3] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. !doend. !enddefine. govind q2 q3 q4a /. HTH, Florio At 09:56 PM 4/15/2008, Govind Acharya wrote: >Hi all, > >Just wondering if there is a way to loop through variables using >ctables? I want to run ctables for a series of variables: > >CTABLES > /VLABELS VARIABLES=dept1 q2 DISPLAY=DEFAULT > /TABLE dept1 [C] BY q2 [C][ROWPCT.COUNT PCT40.1, TOTALS[COUNT F40.0]] > /CATEGORIES VARIABLES=dept1 ORDER=A KEY=VALUE EMPTY=INCLUDE > /CATEGORIES VARIABLES=q2 [1, 2, 3] EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. > >When I try to do a do repeat for q2 q3 q4a..., it fails. Is there a way >to assign a set of variables such that I can repeatedly run the ctables >command above? > >Thanks so much! > >best, >Govind > >-- >- >Govind Acharya >Assistant Director/Senior Research Associate >Survey Research Institute, Cornell University >391 Pine Tree Rd. >Ithaca, NY 14850 >phone: (607) 255-0375; fax: (607) 255-7118 >http://www.sri.cornell.edu > >===================== >To manage your subscription to SPSSX-L, send a message to >[hidden email] (not to SPSSX-L), with no body text except the >command. To leave the list, send the command >SIGNOFF SPSSX-L >For a list of commands to manage subscriptions, send the command >INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
