Sovereign Buch
2019-02-14 20:28:51 UTC
I've made failed attempts at combining a SPSS macro which loops custom tables for all variables to another macro which assigns a table title based on the each variable's label. What would be the best way to combine these two macros?
================Macro: Loop CTABLES================
DEFINE loop1 (!POS !CHAREND('/'))
!DO !i !IN (!1).
ctables
/vlabels
variables = !i
display = none
/table by !i [C][count 'frequency' F40.0,
colpct.count 'percent' PCT40.1]
/clabels
collabels = opposite
/categories
variables = !i
empty = include
/titles
corner = 'Response choices'
title = 'Hi'.
!DOEND.
!ENDDEFINE.
loop1 Q1 Q2... (shortened) /.
================Macro: Table Titles================
DEFINE title1 (inlist = !ENCLOSE("(",")"))
!DO !i !IN (!inlist).
ctables
/vlabels
variables = !i
display = none
/table by !i [C][count 'frequency' F40.0,
colpct.count 'percent' PCT40.1]
/clabels
collabels = opposite
/categories
variables = !i
empty = include
/titles
corner = 'Response choices'
title = !i.
!DOEND.
!ENDDEFINE.
title1 inlist = (Q1 Q2...).
execute.
================Macro: Loop CTABLES================
DEFINE loop1 (!POS !CHAREND('/'))
!DO !i !IN (!1).
ctables
/vlabels
variables = !i
display = none
/table by !i [C][count 'frequency' F40.0,
colpct.count 'percent' PCT40.1]
/clabels
collabels = opposite
/categories
variables = !i
empty = include
/titles
corner = 'Response choices'
title = 'Hi'.
!DOEND.
!ENDDEFINE.
loop1 Q1 Q2... (shortened) /.
================Macro: Table Titles================
DEFINE title1 (inlist = !ENCLOSE("(",")"))
!DO !i !IN (!inlist).
ctables
/vlabels
variables = !i
display = none
/table by !i [C][count 'frequency' F40.0,
colpct.count 'percent' PCT40.1]
/clabels
collabels = opposite
/categories
variables = !i
empty = include
/titles
corner = 'Response choices'
title = !i.
!DOEND.
!ENDDEFINE.
title1 inlist = (Q1 Q2...).
execute.