|
I want to use the 'repeat' to create three same tables of a1 a2 a3 in spss
syntax.The code is: * Multiple Response Tables. do repeat tempvar=a1,a2,a3. TABLES /FORMAT BLANK MISSING('') /GBASE=CASES /TABLE=tempvar . end repeat. But when executed,the output window display sa follow: >Error # 4097. Command name: TABLES >The transformations program contains a DO REPEAT without a terminating END >REPEAT. >This command not executed. >Warning # 4544. Command name: END REPEAT >No commands were found between the DO REPEAT and END REPEAT commands. So please help me solve this probelm |
|
Hi Kevin,
From the SPSS manual: The following commands can be used within a DO REPEATâEND REPEAT structure: Data transformations: COMPUTE, RECODE, IF, COUNT, and SELECT IF · Data declarations: VECTOR, STRING, NUMERIC, and LEAVE · Data definition: DATA LIST, MISSING VALUES (but not VARIABLE LABELS or VALUE LABELS) · Loop structure commands: LOOP, END LOOP, and BREAK · Do-if structure commands: DO IF, ELSE IF, ELSE, and END IF · Print and write commands: PRINT, PRINT EJECT, PRINT SPACE, and WRITE · Format commands: PRINT FORMATS, WRITE FORMATS, and FORMATS You could use a macro instead: set mprint = on. define mymac (!pos !cmdend). !do !cnt !in (!1). title !quote(!concat("This table shows ",!cnt)). TABLES /FORMAT BLANK MISSING('') /GBASE=CASES /TABLE=!cnt . !doend. !enddefine. mymac a1 a2 a3. set mprint = off. CHEERS! Albert-Jan --- Kevin Wong <[hidden email]> wrote: > I want to use the 'repeat' to create three same > tables of a1 a2 a3 in spss > syntax.The code is: > * Multiple Response Tables. > > do repeat tempvar=a1,a2,a3. > TABLES > /FORMAT BLANK MISSING('') > /GBASE=CASES > /TABLE=tempvar . > end repeat. > > But when executed,the output window display sa > follow: > > >Error # 4097. Command name: TABLES > >The transformations program contains a DO REPEAT > without a terminating END > >REPEAT. > >This command not executed. > > > >Warning # 4544. Command name: END REPEAT > >No commands were found between the DO REPEAT and > END REPEAT commands. > > > So please help me solve this probelm > Cheers! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Did you know that 87.166253% of all statistics claim a precision of results that is not justified by the method employed? [HELMUT RICHTER] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ____________________________________________________________________________________ Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/ |
|
In reply to this post by Kevin Wong-2
At 12:05 AM 6/11/2007, Kevin Wong wrote:
>I want to use the 'repeat' to create three same tables of a1 a2 a3 in >spss >syntax.The code is: >* Multiple Response Tables. > >do repeat tempvar=a1,a2,a3. >TABLES > /FORMAT BLANK MISSING('') > /GBASE=CASES > /TABLE=tempvar . >end repeat. Very quickly: DO REPEAT (and LOOP and DO IF, while I'm at it) work only within a transformation program or INPUT PROGRAM. They can't loop over procedures like TABLES. To do that, you need a macro loop (in the general sense of 'macro'). That can be done with an SPSS macro (use command DEFINE) or, if you have it, a Python program. |
|
In reply to this post by Kevin Wong-2
Hi Kevin,
First of all it is not possible to use stat procedures inside the Do Repeat. This loop can only be used to change data with trasnsformation commands such as Compute or Recode. Fortunately many tabulation can be run with more than 1 variable, try TABLES /FORMAT BLANK MISSING('') /GBASE=CASES /TABLE=a1+a2+a3 . (NOT tested) If it does not work a macro is way out: DEFINE !MyTabs (!positional !cmdend). TABLES /FORMAT BLANK MISSING('') /GBASE=CASES /TABLE=!1 . !ENDDEFINE. *Run the macro with all vars in interest. !MyTabs a1. !MyTabs a2. !MyTabs a3. HTH Jindra > ------------ Původní zpráva ------------ > Od: Kevin Wong <[hidden email]> > Předmět: a problem of repeat in spss syntax > Datum: 11.6.2007 18:04:05 > ---------------------------------------- > I want to use the 'repeat' to create three same tables of a1 a2 a3 in spss > syntax.The code is: > * Multiple Response Tables. > > do repeat tempvar=a1,a2,a3. > TABLES > /FORMAT BLANK MISSING('') > /GBASE=CASES > /TABLE=tempvar . > end repeat. > > But when executed,the output window display sa follow: > > >Error # 4097. Command name: TABLES > >The transformations program contains a DO REPEAT without a terminating END > >REPEAT. > >This command not executed. > > > >Warning # 4544. Command name: END REPEAT > >No commands were found between the DO REPEAT and END REPEAT commands. > > > So please help me solve this probelm > > > |
| Free forum by Nabble | Edit this page |
