Discussion:
Insert blank row in ctables
(too old to reply)
j***@yahoo.com
2007-07-19 23:29:27 UTC
Permalink
Hi all,

I know I'm way late to the game at custom tables, but up until a few
weeks ago I was working with SPSS v10. I'm now on v15 and finding some
of my old syntax tricks for TABLES don't work with CTABLES.

For example - I used to use the syntax below to force blank rows into
a large table with multiple variables down the side. When I convert
this syntax into CTABLES it drops my "blank" variables because CTABLES
wants to outsmart me and notes, accurately, that they are...blank. In
TABLES these would just show up as blank rows.

Is there another way to format the table so it will have blank rows
between variables? Or a way to force CTABLES to accept my dummy
variables?

Here is the syntax that worked great in TABLES:

numeric blank1 (f1.0).
var labels blank1 "" .

TABLES
/FORMAT BLANK MISSING('.')
/GBASE=CASES
/FTOTAL= $t000001 "TOTAL # RESP" $t000002 "TOTAL # RESP"
/TABLE=v1 + $t000001 + blank1 + v2 + $t000002
BY v3 + v4
/STATISTICS
cpct( v1( PCT5.0 ) '':v3 v4 )
count( $t000001( F5.0 ) "" )
cpct( blank1( PCT5.0 ) '':v3 v4 )
cpct( v2( PCT5.0 ) '':v3 v4 )
count( $t000002( F5.0 ) "" ).
peter m sopp
2007-07-20 09:25:38 UTC
Permalink
Only a workaround: Have a look at www.spsstools.net and adapt a script
which modify a specific line in your pivot table (for instance:
MakeTotalsBoldAllPivotTables.sbs). Use the color white for your specific
variable - now you have an 'empty' line. Maybe there are better solution
(using python?) but ... ;-)
Peter
Post by j***@yahoo.com
Hi all,
I know I'm way late to the game at custom tables, but up until a few
weeks ago I was working with SPSS v10. I'm now on v15 and finding some
of my old syntax tricks for TABLES don't work with CTABLES.
For example - I used to use the syntax below to force blank rows into
a large table with multiple variables down the side. When I convert
this syntax into CTABLES it drops my "blank" variables because CTABLES
wants to outsmart me and notes, accurately, that they are...blank. In
TABLES these would just show up as blank rows.
Is there another way to format the table so it will have blank rows
between variables? Or a way to force CTABLES to accept my dummy
variables?
numeric blank1 (f1.0).
var labels blank1 "" .
TABLES
/FORMAT BLANK MISSING('.')
/GBASE=CASES
/FTOTAL= $t000001 "TOTAL # RESP" $t000002 "TOTAL # RESP"
/TABLE=v1 + $t000001 + blank1 + v2 + $t000002
BY v3 + v4
/STATISTICS
cpct( v1( PCT5.0 ) '':v3 v4 )
count( $t000001( F5.0 ) "" )
cpct( blank1( PCT5.0 ) '':v3 v4 )
cpct( v2( PCT5.0 ) '':v3 v4 )
count( $t000002( F5.0 ) "" ).
j***@yahoo.com
2007-07-20 16:34:00 UTC
Permalink
Hi Peter,

Okay, I haven't used scripts before, but that was easy and worked
great!

A lot of code and effort for such a simple thing in the old syntax,
but at least I can get to what I need. I have clients who are very
particular about the formatting of their tables, and this will save me
a big headache of trying to explain to them why it looks different.

Thanks!

-Selma
Ivan Moore
2022-08-05 00:49:59 UTC
Permalink
Post by j***@yahoo.com
Hi Peter,
Okay, I haven't used scripts before, but that was easy and worked
great!
A lot of code and effort for such a simple thing in the old syntax,
but at least I can get to what I need. I have clients who are very
particular about the formatting of their tables, and this will save me
a big headache of trying to explain to them why it looks different.
Thanks!
-Selma
Hi Selma,

I am looking to do the exact same thing! It's crazy that SPPS doesn't have the option of inserting blank lines and breaking up the block of percentages in the table. Absolutely no awareness that your average client looking at crosstabs has a hard enough time when they are formatted legibly.

I took a look at the script at spsstools.net and my eyes rolled back in the back of my head. Scripting is not my area of expertise. Can you share your solution?

Thanks,

Ivan

JKPeck
2007-07-20 13:36:24 UTC
Permalink
Post by j***@yahoo.com
Hi all,
I know I'm way late to the game at custom tables, but up until a few
weeks ago I was working with SPSS v10. I'm now on v15 and finding some
of my old syntax tricks for TABLES don't work with CTABLES.
For example - I used to use the syntax below to force blank rows into
a large table with multiple variables down the side. When I convert
this syntax into CTABLES it drops my "blank" variables because CTABLES
wants to outsmart me and notes, accurately, that they are...blank. In
TABLES these would just show up as blank rows.
Is there another way to format the table so it will have blank rows
between variables? Or a way to force CTABLES to accept my dummy
variables?
numeric blank1 (f1.0).
var labels blank1 "" .
TABLES
/FORMAT BLANK MISSING('.')
/GBASE=CASES
/FTOTAL= $t000001 "TOTAL # RESP" $t000002 "TOTAL # RESP"
/TABLE=v1 + $t000001 + blank1 + v2 + $t000002
BY v3 + v4
/STATISTICS
cpct( v1( PCT5.0 ) '':v3 v4 )
count( $t000001( F5.0 ) "" )
cpct( blank1( PCT5.0 ) '':v3 v4 )
cpct( v2( PCT5.0 ) '':v3 v4 )
count( $t000002( F5.0 ) "" ).
Simplifying the syntax, if your Tables command was
Tables /table = x + blank + y,

prefixed by something like
string blank(a8).
comput blank = ''.
variable label blank ' '.

you can get the same effect in Ctables via

Ctables /table x + blank + y.

However, if Ctables finds no valid categories, it does remove the
variable. You can avoid this by specifying MISSING=INCLUDE on the
CATEGORIES subcommand for the blank variable. I.e.,
/CATEGORIES blank MISSING=INCLUDE.
j***@yahoo.com
2007-07-20 16:16:28 UTC
Permalink
Hi JK,

Thanks for that advice, I did try that before I posted. The problem
is, while it does put a blank space between the labels on the left, it
still includes the totals across the row...which defeats the purpose
since what I'm trying to do is make the table more readable by having
blank space between the total for one variable and the first figure
for the next.

In the old tables syntax this would just appear as a blank all the way
across the row.
Loading...