I just noticed
that, the Table Properties (double click the table, right click -> Table Properties
: Hide empty rows and columns) do also not work in my example below. Can someone help
here? TIA, Christian From:
SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la Thanks Chris I know this but
this doesn't work neither. Christian ********************************** Von: SPSSX(r)
Discussion [mailto:[hidden email]] Im
Auftrag von Chris Hunt EMPTY = exclude only
excludes values that have a count of zero. You need MISSING =
Exclude to exclude the values you have selected as missing. Chris From:
SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of la Hi all I would like to exclude an
empty row in a Table. I used a code that did that perfectly well in SPSS 15
using EMPTY = exclude. However in SPSS 18 and SPSS
19 the row (Test) will always appear in the Table. Does anybody have a solution
for that? TIA, Christian data list list /Medi(F8.0) Sex(F8.1)
Age(F8.2) Test(F8.2) . begin data 1 1 44.25 50 2 1 52.92 40 1 1 37.21 30 1 1 60.87 30 2 1 58.69 20 2 2 43.17 20 1 2 44.93 10 1 1 34.19 60 1 2 39.96 70 2 1 63.04 70 End Data. Var Label Medi 'Treatment'. Val Label Medi 1 'Verum'
2 'Placebo'. REcode Test (else = 99). MISSING VALUES Test (99). exec. CTABLES /Format Missing = ''
Empty = Zero /VLABELS
VARIABLES=Medi Sex Age Test
DISPLAY=Label /TABLE Age
[s][MEAN F8.2] +
Test [s][MEAN F8.2] BY
Medi[c] /SLABELS
POSITION=Column VISIBLE = no /CATEGORIES
VARIABLES=Medi ORDER=A KEY=VALUE EMPTY=EXCLUDE. **********************************
Christian Schmidhauser, Dr.phil.II
|
I'm not why entirely blank rows are not
being hidden. If you edit the table and double click each blank cell
without changing anything and close the editor, the blank row disappears,
at least with 19.0.0.1.
It is possible, though, to make these disappear by using SPSSINC MODIFY TABLES (from the SPSS Community at www.ibm.com/developerworks/spssdevcentral) by adding a small custom scriptlet. Here is an example: CTABLES /Format Missing = '' Empty = Zero /VLABELS VARIABLES=Medi Sex Age Test DISPLAY=Label /TABLE Age [s][MEAN] + Test [s][MEAN] BY Medi[c] /SLABELS POSITION=Column VISIBLE = no /CATEGORIES VARIABLES=Medi ORDER=A KEY=VALUE EMPTY=EXCLUDE. SPSSINC MODIFY TABLES subtype="Custom Table" SELECT="<<ALL>>" DIMENSION= ROWS /STYLES CUSTOMFUNCTION="customstylefunctions.hideBlankRows". To make this work, you need to add this little bit of code to the end of the customstylefunctions.py module included with the command. Indentation is critical here. If the listserv mangles this, I can put it in the forums. def hideBlankRows(obj, i, j, numrows, numcols, section, more): """hide rows that appear entirely blank""" if not section =="datacells": return for c in range(numcols): if obj.GetValueAt(i,c) != "": break else: more.rowlabelarray.HideLabelsWithDataAt(i,c) To do all the tables in the Viewer at once, you can add PROCESS = ALL to the command (before the STYLES subcommand). Jon Peck Senior Software Engineer, IBM [hidden email] 312-651-3435 From: la volta statistics <[hidden email]> To: [hidden email] Date: 02/25/2011 10:24 AM Subject: [SPSSX-L] WG: Hoe to hide empty row in CTABLES Sent by: "SPSSX(r) Discussion" <[hidden email]> I just noticed that, the Table Properties (double click the table, right click -> Table Properties : Hide empty rows and columns) do also not work in my example below. Can someone help here? TIA, Christian From: SPSSX(r) Discussion [[hidden email]] On Behalf Of la volta statistics Sent: 25 February 2011 15:11 To: [hidden email] Subject: AW: Hoe to hide empty row in CTABLES Thanks Chris I know this but this doesn't work neither. Christian ********************************** la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:schmidhauser@... Web: www.lavolta.ch Von: SPSSX(r) Discussion [[hidden email]] Im Auftrag von Chris Hunt Gesendet: Freitag, 25. Februar 2011 15:50 An: [hidden email] Betreff: Re: Hoe to hide empty row in CTABLES EMPTY = exclude only excludes values that have a count of zero. You need MISSING = Exclude to exclude the values you have selected as missing. Chris From: SPSSX(r) Discussion [[hidden email]] On Behalf Of la volta statistics Sent: 25 February 2011 14:15 To: [hidden email] Subject: Hoe to hide empty row in CTABLES Hi all I would like to exclude an empty row in a Table. I used a code that did that perfectly well in SPSS 15 using EMPTY = exclude. However in SPSS 18 and SPSS 19 the row (Test) will always appear in the Table. Does anybody have a solution for that? TIA, Christian data list list /Medi(F8.0) Sex(F8.1) Age(F8.2) Test(F8.2) . begin data 1 1 44.25 50 2 1 52.92 40 1 1 37.21 30 1 1 60.87 30 2 1 58.69 20 2 2 43.17 20 1 2 44.93 10 1 1 34.19 60 1 2 39.96 70 2 1 63.04 70 End Data. Var Label Medi 'Treatment'. Val Label Medi 1 'Verum' 2 'Placebo'. REcode Test (else = 99). MISSING VALUES Test (99). exec. CTABLES /Format Missing = '' Empty = Zero /VLABELS VARIABLES=Medi Sex Age Test DISPLAY=Label /TABLE Age [s][MEAN F8.2] + Test [s][MEAN F8.2] BY Medi[c] /SLABELS POSITION=Column VISIBLE = no /CATEGORIES VARIABLES=Medi ORDER=A KEY=VALUE EMPTY=EXCLUDE. ********************************** la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:schmidhauser@... Web: www.lavolta.ch |
Hello,
I am a long time user of SPSS but not the newer Python/SPSSINC. In the post this is exactly what I want to do Delete Empty rows from a Mean CTABLE. But where do I find "customstylefunctions.py module" to add the Def and in the post it looks like it has been truncated, where can I find the entire definition? I need newbie instructions of where to find this stuff and how to navigate it once I see it I can figure it out. but can not find where to look to find the python code and do the basic navigation. Thanks, ~Kevin. -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== 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 |
CTABLES has a regular way of excluding empty rows or columns. You can specify EMPTY=EXCLUDE on the relevant CATEGORIES subcommand. However, if you are referring to using the SPSSINC MODIFY TABLES extension command (Utilities > Modify Table Appearance) , which is one of many available extensions, you would install it from the Extensions menu or Utilities in older versions of Statistics. Then, here is an example of using this function. SPSSINC MODIFY TABLES subtype="customtable" SELECT="<<ALL>>" DIMENSION= ROWS LEVEL = -1 PROCESS = PRECEDING /STYLES APPLYTO=DATACELLS CUSTOMFUNCTION="customstylefunctions.hideBlankRow". You do not need to find the customstylefunctions.py module, which is installed with the extension command, since the command will find it automatically, but if you want to see all the custom functions and examples, you can run this code from a syntax window to see where it was installed. begin program. import customstylefunctions print customstylefunctions end program. You can open it in any plain text editor. Note that in the case of CTABLES, by default cells where a value can't be computed have "." in them, so you would need to specify MISSING="" on the FORMAT subcommand in order for this function to work. On Sat, Dec 29, 2018 at 7:43 PM Kevin longfield <[hidden email]> wrote: Hello, |
Free forum by Nabble | Edit this page |