SPSS Statistics

SPSS Statistics

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

 View Only
  • 1.  CTABLES query

    Posted Tue October 27, 2020 01:39 PM

    I am running custom tables that need to produce a percentage of time spent to a particular channel as a percentage of total time spent. Both values exist as scale variables. Could you advise on this please?






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: CTABLES query

    Posted Tue October 27, 2020 02:25 PM

    You can do this by using a computed category. Here is an example using the employee data.sav file shipped with Statistics. If you have a total in the table, you could use that as the denominator.

    CTABLES

    /PCOMPUTE &cat1 = EXPR(['f'] / (['f'] + ['m']) * 100)

    /PPROPERTIES &cat1 LABEL = " percent female" FORMAT=MEAN PCT40.0 HIDESOURCECATS=NO

    /TABLE gender > (salary [MEAN] + salbegin [MEAN]) BY minority

    /CATEGORIES VARIABLES=gender ['f', 'm', &cat1, OTHERNM] EMPTY=INCLUDE

    /CATEGORIES VARIABLES=minority ORDER=A KEY=VALUE EMPTY=INCLUDE MISSING=EXCLUDE.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: CTABLES query

    Posted Tue October 27, 2020 02:34 PM

    p.s. Depending on your question, you might choose either MEAN or SUM as the statistic.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: CTABLES query

    Posted Tue October 27, 2020 02:41 PM

    Thanks but I can't see how this would work where total time is stored as a scale variable and programme time as a separate scale variable (stored as hours & decimals of hours). I would need to compute e.g. (ProgTime/TotalTime)*100 and I understand pcompute doesn't allow references to 2 separate variables?​






    #SPSSStatistics
    #Support
    #SupportMigration


  • 5.  RE: CTABLES query

    Posted Tue October 27, 2020 02:45 PM

    If total time is just the sum of the program times, you could use a total. If not, you could use the STATS TABLE CALC extension command to add this in. If you send me an spv file with the table with both variables in it, I'll show you how to do that calculation. (jkpeckSupport Member)






    #SPSSStatistics
    #Support
    #SupportMigration