Using Macros and CTABLE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * (Q) I need a macro that would accept row and column variables and use these as row and column * variables of a CTABLE. How can I do this? * (A) Raynald Levesque 2004. GET FILE='c:\\program files\\spss\\employee data.sav'. *////////////////. DEFINE !ctable(row=!CHAREND('/') /col=!CMDEND) CTABLES /VLABELS VARIABLES= !row !col DISPLAY=DEFAULT /TABLE !HEAD(!row) !DO !v !IN (!TAIL(!row)) + !v !DOEND BY (!HEAD(!col) !DO !v !IN (!TAIL(!col)) + !v !DOEND ) [ROWPCT.COUNT PCT40.1, TOTALS[COUNT F40.0]] /CATEGORIES VARIABLES= !row ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=BEFORE /CATEGORIES VARIABLES=!col ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=BEFORE. !ENDDEFINE. *////////////////. VARIABLE LEVELS jobtime (NOMINAL). SET MPRINT=yes. !ctable row=jobcat minority /col=gender jobtime. SET MPRINT=no. |
Related pages
...