Need Help With Ctab Macro!

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Help With Ctab Macro!

Samir-17
I am using a ctab macro from Raynald Levesque site, which goes like this

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 ) [COLPCT.COUNT
PCT40.0, TOTALS[COUNT F40.0]]
/CATEGORIES VARIABLES= !row ORDER=A KEY=VALUE EMPTY=EXCLUDE
/CATEGORIES VARIABLES=!col ORDER=A KEY=VALUE EMPTY=INCLUDE.
!ENDDEFINE.

This is working fine for the normal custom table I run by Recalling the
macro by statements given below.

!ctable row=varlist /col=D3.

Now, I want to give an additional condition where I can exclude any
categories that have less than 10 responses. How can I do that? Any help in
this regard would be appreciated.

I am using version 11.5 of SPSS.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Need Help With Ctab Macro!

Jon K Peck

I can't think of any reasonable automated way to blank table cells based on a cell count with 11.5, although you could write a rather complicated SaxBasic script to do that.  You could use AGGREGATE followed by a selection based on count to exclude entire cases, but that would remove data that ought to appear in cells where the count is big enough.  With V17 or later, you could use the SPSSINC CENSOR TABLES extension command to blank out cells according to the cell count or other criteria.

Regards,

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Samir <[hidden email]>
To: [hidden email]
Date: 03/16/2010 08:16 AM
Subject: [SPSSX-L] Need Help With Ctab Macro!
Sent by: "SPSSX(r) Discussion" <[hidden email]>





I am using a ctab macro from Raynald Levesque site, which goes like this

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 ) [COLPCT.COUNT
PCT40.0, TOTALS[COUNT F40.0]]
/CATEGORIES VARIABLES= !row ORDER=A KEY=VALUE EMPTY=EXCLUDE
/CATEGORIES VARIABLES=!col ORDER=A KEY=VALUE EMPTY=INCLUDE.
!ENDDEFINE.

This is working fine for the normal custom table I run by Recalling the
macro by statements given below.

!ctable row=varlist /col=D3.

Now, I want to give an additional condition where I can exclude any
categories that have less than 10 responses. How can I do that? Any help in
this regard would be appreciated.

I am using version 11.5 of SPSS.

=====================
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