SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Syntax for working with Custom Table Output

    Posted Thu December 17, 2020 06:07 PM

    Hello,

    I have been using custom tables to combine several variables (e.g., medicare, medicaid, private insurance, no insurance) that have the same categories (e.g., Yes, No, Unknown) to make the data visualization more powerful. After running the syntax (I've pasted an example below), I then use my mouse to select the row of Yes and then right click to create graph --> bar to create a bar graph that shows all the variables side by side.

    I would like some resources so I can accomplish this entire process using syntax so that it is easier to repeat at a later date and to record my process.

    CTABLES /VLABELS VARIABLES=appMedicaid appMedicare appACAExchange appOtherPublicIns appEmployerIns appEmployerInsNYE appOtherPrivateIns DISPLAY=LABEL /TABLE BY appMedicaid [COUNT F40.0] + appMedicare [COUNT F40.0] + appACAExchange [COUNT F40.0] + appOtherPublicIns [COUNT F40.0] + appEmployerIns [COUNT F40.0] + appEmployerInsNYE [COUNT F40.0] + appOtherPrivateIns [COUNT F40.0] /SLABELS VISIBLE=NO /CLABELS COLLABELS=OPPOSITE /CATEGORIES VARIABLES=appMedicaid appMedicare appACAExchange appOtherPublicIns appEmployerIns appEmployerInsNYE appOtherPrivateIns ORDER=D KEY=VALUE EMPTY=INCLUDE /CRITERIA CILEVEL=95 /TITLES TITLE='Health Insurance at Application (*may receive more than one type)'.

    To create graph:

    • double click table in output
    • click and drag all cells in the Yes row
    • right click - hover over "create graph" from context menu
    • left click on "bar" from submenu
    • double click on resulting graph and use the menus in popup window to:
      • show data labels
      • Adjust titles on axis and chart title





    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: Syntax for working with Custom Table Output

    Posted Thu December 17, 2020 06:59 PM

    Unfortunately, there are no apis to script creating a chart from a pivot table. The choices would be to create the desired chart from scratch using the Chart Builder (GGRAPH) or, perhaps, to use OMS to capture the table as a dataset and then use that as input to GGRAPH.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: Syntax for working with Custom Table Output

    Posted Thu December 17, 2020 08:05 PM

    Thank you, I’m unfamiliar with OMS and am currently learning the command in depth. I resorted to this strategy when I couldn’t figure out how to do it in GGRAPH and GPL. If you know how to do this with that, I would welcome your suggestions. I think you may be onto something with combining OMS and GGRAPH.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: Syntax for working with Custom Table Output

    Posted Thu December 17, 2020 08:25 PM

    If you want to send me some sample data, I can take a look.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 5.  RE: Syntax for working with Custom Table Output

    Posted Wed January 20, 2021 11:10 PM

    I just put together a couple hundred lines of sample data with 7 variables to play with. I'm not sure the best way to share it, but I've copied it below and will upload it differently if there is a way to do so. Similar to the code above, I'm trying to get the Yes response (coded as 1) for each variable race/ethnicity to show side by side, instead of a separate graph per variable because they all use the same coding scheme. I then want to cluster the Yes responses for each variable by the appSS variable.


    Thank you!






    #SPSSStatistics
    #Support
    #SupportMigration


  • 6.  RE: Syntax for working with Custom Table Output

    Posted Wed January 20, 2021 11:14 PM

    Sample Data:

    AmerIndian Asian Black Hawaiian White Hispanic appSS
    0 0 0 0 1 1 4
    0 0 0 0 1 0 4
    0 0 1 0 0 0 4
    0 0 1 0 0 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 1 4
    1 0 0 0 0 0 1
    0 0 0 0 1 0 4
    0 0 0 0 1 1 4
    0 0 0 0 1 0 2
    0 0 1 0 0 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 1 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 1
    0 0 0 0 1 1 4
    0 0 1 0 0 0 4
    0 0 1 0 0 0 1
    0 0 0 0 1 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 4
    9 9 9 9 9 9 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 1
    0 0 1 0 0 0 4
    0 0 0 0 1 0 4
    0 0 0 0 1 0 1
    0 0 0 0 1 1 4
    9 9 9 9 9 9 4







    #SPSSStatistics
    #Support
    #SupportMigration