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 ) "" ).
je...@yahoo.com schrieb:
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.
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.
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