Discussion:
Combining two SPSS scripts (macros)
(too old to reply)
Sovereign Buch
2019-02-14 20:28:51 UTC
Permalink
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.
Bruce Weaver
2019-02-14 23:19:20 UTC
Permalink
Post by Sovereign Buch
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?
--- snip the macros ---

The SPSS mailing list (http://spssx-discussion.1045642.n5.nabble.com/) is a lot more active than this forum these days. You might want to join that list (if not already a member) and post your question there. Via the page given above, click on -more options- near the top for info on how to subscribe. HTH.
Loading...