Hi All,
I have searched the list, Google and the FM, however, since I have had no luck I thought I would ask the list. Is it possible to use syntax to create a new coloumn in the following custom table * Custom Tables. CTABLES /VLABELS VARIABLES=DISPOSITION CAT1 CAT2 TOTAL DISPLAY=LABEL /TABLE DISPOSITION [C] BY CAT1 [S][SUM] + CAT2 [S][SUM] + TOTAL [S][SUM] /SLABELS VISIBLE=NO /CATEGORIES VARIABLES=DISPOSITION ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. This creates the following table. CAT1 CAT2 Total (Number) Completed 71 7 78.00 Did Not Complete 67 19 86.00 Total 138 26 164.00 I would like to compute a fourth category CAT3 "Rate"... so the the table looks like the following: This creates the following table. CAT1 CAT2 Total (Number) Rate % Completed 71 7 78.00 9.0 Did Not Complete 67 19 86.00 21.1 Total 138 26 164.00 15.9 I tried to incorporate the following sub-command with no luck. Any suggestions would be greatly appreciated. /PCOMPUTE &RATE = EXPR (([CAT2] / [TOTAL])*100) Thank you, Damir |
What is the problem you are having? Something like
this example using employee data.sav would appear to do this. I put
the total at the front. It would default to the end.
CTABLES /PCOMPUTE &cat1 = EXPR([1] / ([1]+TOTAL) * 100) /PPROPERTIES &cat1 LABEL = "cat3" FORMAT=COUNT F10.3 HIDESOURCECATS=NO /TABLE gender [C][COUNT F40.0] BY minority [C] /CATEGORIES VARIABLES=gender ORDER=A KEY=VALUE EMPTY=INCLUDE /CATEGORIES VARIABLES=minority [0, 1, &cat1, OTHERNM] EMPTY=INCLUDE TOTAL=YES POSITION=BEFORE . If the issue is the location of the total column, you would need to use something like the STATS TABLE CALC extension command (Utilities > Calculate with Pivot Table) to do this. Here is an example. CTABLES /TABLE gender [C][COUNT F40.0] BY minority [C] /CATEGORIES VARIABLES=minority TOTAL=YES. STATS TABLE CALC SUBTYPE="customtable" /TARGET FORMULA="x1/x2" DIMENSION=COLUMNS LEVEL = -2 LOCATION="Total" LABEL="ratio" MODE=AFTER. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: DKUKEC <[hidden email]> To: [hidden email], Date: 09/11/2013 04:26 PM Subject: [SPSSX-L] Compute Between Categories in Custom Tables /PCOMPUTE Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi All, I have searched the list, Google and the FM, however, since I have had no luck I thought I would ask the list. Is it possible to use syntax to create a new coloumn in the following custom table * Custom Tables. CTABLES /VLABELS VARIABLES=DISPOSITION CAT1 CAT2 TOTAL DISPLAY=LABEL /TABLE DISPOSITION [C] BY CAT1 [S][SUM] + CAT2 [S][SUM] + TOTAL [S][SUM] /SLABELS VISIBLE=NO /CATEGORIES VARIABLES=DISPOSITION ORDER=A KEY=VALUE EMPTY=EXCLUDE TOTAL=YES POSITION=AFTER. This creates the following table. CAT1 CAT2 Total (Number) Completed 71 7 78.00 Did Not Complete 67 19 86.00 Total 138 26 164.00 I would like to compute a fourth category CAT3 "Rate"... so the the table looks like the following: This creates the following table. CAT1 CAT2 Total (Number) Rate % Completed 71 7 78.00 9.0 Did Not Complete 67 19 86.00 21.1 Total 138 26 164.00 15.9 I tried to incorporate the following sub-command with no luck. Any suggestions would be greatly appreciated. /PCOMPUTE &RATE = EXPR (([CAT2] / [TOTAL])*100) Thank you, Damir -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Compute-Between-Categories-in-Custom-Tables-PCOMPUTE-tp5721922.html Sent from the SPSSX Discussion mailing list archive at 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 |
Free forum by Nabble | Edit this page |