SPSS Statistics

 View Only
  • 1.  Hide Columns using SPSS MODIFY TABLES

    Posted Fri June 02, 2023 06:23 PM
    Edited by David Dwyer Fri June 02, 2023 06:35 PM

    Hi

    I am using SPSSINC MODIFY TABLES  to hide the columns with the label 'Count' in Custom Tables. I know that I can remove them in Ctables script but I need them so I can have the Pearson table.

    My Ctable syntax (using Macros) is as follows:

    define !MyCtabMacro (!pos=!cmdend)
    !do !onevar !in(!1)
       CTABLES
       /VLABELS VARIABLES=!onevar mohafaza
    caza
    village
    A03
    NewAge
    A05
    A06
    Votingdistrict
    A08
    A09
    A10
    A11
    HoH
    A12
    A13
    A14
    A1501
    A1502
    A1503
    A1504
    A1505
    A1506
    DISPLAY=LABEL
       /TABLE  (mohafaza [c] + caza[c] + village [c]+A03[c]+ NewAge[c]+A05[C] +  A06[C] +Votingdistrict[c] +A08[c] + A09[c] +A10[c] + A11[c] + HoH[c]+A12[c] + A13[c]+
     Income[c] + A1501[c] + A1502[c] + A1503 + A1504[c] + A1505[c]+ A1506[c]) [COUNT F40.0, ROWPCT.VALIDN PCT40.1] by !onevar [C]
     /CATEGORIES VARIABLES=mohafaza
    caza
    village
    A03
    NewAge
    A05
    A06
    Votingdistrict
    A08
    A09
    A10
    A11
    HoH
    A12
    A13
    Income
    A1501
    A1502
    A1503
    A1504
    A1505
    A1506
    !onevar  ORDER=A KEY=VALUE EMPTY=EXCLUDE Total=NO POSITION=After
      /SIGTEST TYPE=CHISQUARE ALPHA=0.05 INCLUDEMRSETS=YES CATEGORIES=ALLVISIBLE.
    EXECUTE.
       filter off. 
    !doend
    !enddefine.
    
    !MyCtabMacro B1701
    B1702
    B1703
    B1704
    B1705
    B1706
    B1708
    B1709
    B17a
    B17b

    The output is like that:

    Original Output

    I then use the SPSS Modify Table:

    SPSSINC MODIFY TABLES subtype="'Custom Table'"
    SELECT='Count' 
    DIMENSION= COLUMNS LEVEL = -1  SIGLEVELS=BOTH 
    PROCESS = ALL HIDE=TRUE 
    /STYLES  APPLYTO=DATACELLS.

    However, now the tables are missing all the titles and they are messed up like the below:

    My questions are: is there anything that can be done? and my second question, can "Row Valid N %" Label be changed to "Percent"?

    Thanks

    Edit: My second question was easily resolved by adding 'Percent' to [COUNT F40.0, ROWPCT.VALIDN 'Percent' PCT40.1]

    ------------------------------
    Wael Kassem
    ------------------------------



  • 2.  RE: Hide Columns using SPSS MODIFY TABLES

    Posted Fri June 02, 2023 06:34 PM
      |   view attached

    Hi @Wael Kassem 

    I'm not sure what to tell you.  The example table you gave has preceding totals in the Rows and Columns.  The command syntax you gave does not create preceding totals. 
     /CATEGORIES VARIABLES= <your variable list> !onevar  ORDER=A KEY=VALUE EMPTY=EXCLUDE Total=NO POSITION=After
     

    What else is different about your replication scenario?

    In answer to your second question... Yes, simply change the label in your CTABLES command syntax:

     /TABLE  (<Long list of stacked variables>) [COUNT F40.0, ROWPCT.VALIDN PCT40.1] by !onevar [C]

    becomes

     /TABLE (<Long list of stacked variables>) [COUNT F40.0, ROWPCT.VALIDN ' Percent' PCT40.1] by !onevar [C]

    You seem to be on the right track.  Here is an example that creates its own data and runs your command syntax as you indicated you wanted it.  It then runs SPSSINC MODIFY TABLES.




    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software
    ------------------------------

    Attachment(s)

    zip
    community.sps.zip   811 B 1 version


  • 3.  RE: Hide Columns using SPSS MODIFY TABLES

    IBM Champion
    Posted Fri June 02, 2023 06:40 PM
    If you can send me an spv file containing the table, I'll figure this out (jkpeck@gmail.com).  Also, what version of Statistics are you using?

    --





  • 4.  RE: Hide Columns using SPSS MODIFY TABLES

    Posted Sat June 03, 2023 03:38 AM
    Edited by Wael Kassem Sat June 03, 2023 03:44 AM

    Using Statistics v25.

    I sent the spv file to your email


    ------------------------------
    Wael Kassem
    ------------------------------



  • 5.  RE: Hide Columns using SPSS MODIFY TABLES

    IBM Champion
    Posted Sat June 03, 2023 05:32 PM
    Thanks for the spv file.  There is definitely an SPSS bug here - Dave, please file, but I think I have a workaround.

    I could reproduce the problem in 29.0.1.  Using employee data.sav, I ran a table with the same structure.

    CTABLES
      /VLABELS VARIABLES=educ minority jobcat gender DISPLAY=LABEL
      /TABLE educ > minority [COUNT F40.0, ROWPCT.VALIDN PCT40.1] BY jobcat > gender
      /CATEGORIES VARIABLES=educ minority gender ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE
      /CATEGORIES VARIABLES=jobcat ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=AFTER
        MISSING=EXCLUDE
      /CRITERIA CILEVEL=95.

    and then the MODIFY TABLES command.
    SPSSINC MODIFY TABLES subtype="'Custom Table'" SELECT='Count'
        DIMENSION= COLUMNS LEVEL = -1 SIGLEVELS=BOTH
        PROCESS = preceding HIDE=TRUE /STYLES APPLYTO=labels.

    That failed even with several variations.  I found that using the pivot table editor, the OUTPUT MODIFY command, and SPSSINC MODIFY TABLES all produced the same wrong behavior.

    However, if I reversed the COUNT and ROWPCT order, I got the correct result.  Since the goal here was to hide the count column, that change is harmless.  I could export it to Excel, also, and the result was correct.  I only tried this on that one table.

    --





  • 6.  RE: Hide Columns using SPSS MODIFY TABLES

    Posted Sun June 04, 2023 06:49 AM

    @Jon Peck  Thank you! It was driving me crazy.. And thank you for the workaround!!! It works on v25 too on all the tables I tried.



    ------------------------------
    Wael Kassem
    ------------------------------



  • 7.  RE: Hide Columns using SPSS MODIFY TABLES

    Posted Mon June 05, 2023 01:26 PM

    Hi @Jon Peck 
    You're going to have to give me more to go on.  I ran your syntax example in Statistics 25.0.0.2 and 29.0.1.0 (Windows) as well as 29.0.1.0 (macOS) and I get the same (successful looking) result.  I'm not sure what behavior I am filing a defect against since I can't replicate it.



    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software
    ------------------------------



  • 8.  RE: Hide Columns using SPSS MODIFY TABLES

    Posted Mon June 05, 2023 01:58 PM
    Edited by David Dwyer Mon June 05, 2023 02:33 PM

    Ah, Nevermind.  I am blind... and now I see.

    Please subscribe to Known Issue DT215992.

    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software
    ------------------------------

    Hi @Jon Peck 
    You're going to have to give me more to go on.  I ran your syntax example in Statistics 25.0.0.2 and 29.0.1.0 (Windows) as well as 29.0.1.0 (macOS) and I get the same (successful looking) result.  I'm not sure what behavior I am filing a defect against since I can't replicate it.



    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software

    Original Message:
    Sent: Sat June 03, 2023 05:31 PM
    From: Jon Peck
    Subject: Hide Columns using SPSS MODIFY TABLES

    Thanks for the spv file.  There is definitely an SPSS bug here - Dave, please file, but I think I have a workaround.
    I could reproduce the problem in 29.0.1.  Using employee data.sav, I ran a table with the same structure.
    CTABLES
      /VLABELS VARIABLES=educ minority jobcat gender DISPLAY=LABEL
      /TABLE educ > minority [COUNT F40.0, ROWPCT.VALIDN PCT40.1] BY jobcat > gender
      /CATEGORIES VARIABLES=educ minority gender ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE
      /CATEGORIES VARIABLES=jobcat ORDER=A KEY=VALUE EMPTY=INCLUDE TOTAL=YES POSITION=AFTER
        MISSING=EXCLUDE
      /CRITERIA CILEVEL=95.
    and then the MODIFY TABLES command.
    SPSSINC MODIFY TABLES subtype="'Custom Table'" SELECT='Count'
        DIMENSION= COLUMNS LEVEL = -1 SIGLEVELS=BOTH
        PROCESS = preceding HIDE=TRUE /STYLES APPLYTO=labels.
    That failed even with several variations.  I found that using the pivot table editor, the OUTPUT MODIFY command, and SPSSINC MODIFY TABLES all produced the same wrong behavior.
    However, if I reversed the COUNT and ROWPCT order, I got the correct result.  Since the goal here was to hide the count column, that change is harmless.  I could export it to Excel, also, and the result was correct.  I only tried this on that one table.
    --




    Original Message:
    Sent: 6/3/2023 3:38:00 AM
    From: Wael Kassem
    Subject: RE: Hide Columns using SPSS MODIFY TABLES

    Using Statistics v25.

    I sent the spv file to your email


    ------------------------------
    Wael Kassem

    Original Message:
    Sent: Fri June 02, 2023 06:39 PM
    From: Jon Peck
    Subject: Hide Columns using SPSS MODIFY TABLES

    If you can send me an spv file containing the table, I'll figure this out (jkpeck@gmail.com).  Also, what version of Statistics are you using?
    --




    Original Message:
    Sent: 6/2/2023 6:34:00 PM
    From: David Dwyer
    Subject: RE: Hide Columns using SPSS MODIFY TABLES

    Hi @Wael Kassem 

    I'm not sure what to tell you.  The example table you gave has preceding totals in the Rows and Columns.  The command syntax you gave does not create preceding totals. 
     /CATEGORIES VARIABLES= <your variable list> !onevar  ORDER=A KEY=VALUE EMPTY=EXCLUDE Total=NO POSITION=After
     

    What else is different about your replication scenario?

    In answer to your second question... Yes, simply change the label in your CTABLES command syntax:

     /TABLE  (<Long list of stacked variables>) [COUNT F40.0, ROWPCT.VALIDN PCT40.1] by !onevar [C]

    becomes

     /TABLE (<Long list of stacked variables>) [COUNT F40.0, ROWPCT.VALIDN ' Percent' PCT40.1] by !onevar [C]

    You seem to be on the right track.  Here is an example that creates its own data and runs your command syntax as you indicated you wanted it.  It then runs SPSSINC MODIFY TABLES.




    ------------------------------
    David Dwyer
    SPSS Technical Support
    IBM Software

    Original Message:
    Sent: Fri June 02, 2023 05:21 PM
    From: Wael Kassem
    Subject: Hide Columns using SPSS MODIFY TABLES

    Hi

    I am using SPSSINC MODIFY TABLES  to hide the columns with the label 'Count' in Custom Tables. I know that I can remove them in Ctables script but I need them so I can have the Pearson table.

    My Ctable syntax (using Macros) is as follows:

    define !MyCtabMacro (!pos=!cmdend)!do !onevar !in(!1)   CTABLES   /VLABELS VARIABLES=!onevar mohafazacazavillageA03NewAgeA05A06VotingdistrictA08A09A10A11HoHA12A13A14A1501A1502A1503A1504A1505A1506DISPLAY=LABEL   /TABLE  (mohafaza [c] + caza[c] + village [c]+A03[c]+ NewAge[c]+A05[C] +  A06[C] +Votingdistrict[c] +A08[c] + A09[c] +A10[c] + A11[c] + HoH[c]+A12[c] + A13[c]+ Income[c] + A1501[c] + A1502[c] + A1503 + A1504[c] + A1505[c]+ A1506[c]) [COUNT F40.0, ROWPCT.VALIDN PCT40.1] by !onevar [C] /CATEGORIES VARIABLES=mohafazacazavillageA03NewAgeA05A06VotingdistrictA08A09A10A11HoHA12A13IncomeA1501A1502A1503A1504A1505A1506!onevar  ORDER=A KEY=VALUE EMPTY=EXCLUDE Total=NO POSITION=After  /SIGTEST TYPE=CHISQUARE ALPHA=0.05 INCLUDEMRSETS=YES CATEGORIES=ALLVISIBLE.EXECUTE.   filter off. !doend!enddefine.!MyCtabMacro B1701B1702B1703B1704B1705B1706B1708B1709B17aB17b

    The output is like that:

    Original Output

    I then use the SPSS Modify Table:

    SPSSINC MODIFY TABLES subtype="'Custom Table'"SELECT='Count' DIMENSION= COLUMNS LEVEL = -1  SIGLEVELS=BOTH PROCESS = ALL HIDE=TRUE /STYLES  APPLYTO=DATACELLS.

    However, now the tables are missing all the titles and they are messed up like the below:

    My questions are: is there anything that can be done? and my second question, can "Row Valid N %" Label be changed to "Percent"?

    Thanks

    Edit: My second question was easily resolved by adding 'Percent' to [COUNT F40.0, ROWPCT.VALIDN 'Percent' PCT40.1]

    ------------------------------
    Wael Kassem
    ------------------------------



  • 9.  RE: Hide Columns using SPSS MODIFY TABLES

    Posted Mon June 05, 2023 05:50 PM

    Thanks both!



    ------------------------------
    Wael Kassem
    ------------------------------