Custom table: Column % based on SUM

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom table: Column % based on SUM

Ketty Tanizar Noonan
Hello,


How can I calculate Col % based on SUM?


This is the syntax I used:


CTABLES  /TABLE 
PL1_vol [SUM, COLPCT.SUM PCT40.1] + Dole1_vol [SUM, COLPCT.SUM PCT40.1] + AO1_vol [SUM,COLPCT.SUM PCT40.1] 
BY PL_buyer [C] .

This is what I got from running the syntax:

                                       PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        100%
Dole1_vol          40                        100%
AO1_vol             30                        100%


This is what I am looking for. Notice the Col Sum % sums to 100%.

                                  PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        30%
Dole1_vol          40                        40%
AO1_vol             30                        30%


Thanks!

Ketty
Reply | Threaded
Open this post in threaded view
|

Re: Custom table: Column % based on SUM

Jon K Peck
Look at the PCOMPUTE subcommand in CTABLES.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Ketty Tanizar Noonan <[hidden email]>
To:        [hidden email],
Date:        10/09/2013 02:23 PM
Subject:        [SPSSX-L] Custom table: Column % based on SUM
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hello,


How can I calculate Col % based on SUM?


This is the syntax I used:


CTABLES  /TABLE 
PL1_vol [SUM, COLPCT.SUM PCT40.1] + Dole1_vol [SUM, COLPCT.SUM PCT40.1] + AO1_vol [SUM,COLPCT.SUM PCT40.1] 
BY PL_buyer [C] .

This is what I got from running the syntax:

                                       PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        100%
Dole1_vol          40                        100%
AO1_vol             30                        100%


This is what I am looking for. Notice the Col Sum % sums to 100%.

                                  PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        30%
Dole1_vol          40                        40%
AO1_vol             30                        30%


Thanks!

Ketty
Reply | Threaded
Open this post in threaded view
|

Re: Custom table: Column % based on SUM

Javier Figueroa
Hola!
Espero esto te sirva.

Saludos


/* Esto es lo que tienes que hacer.

VARSTOCASES
  /ID=id
  /MAKE DATA FROM PL1_vol Dole1_vol AO1_vol
  /INDEX=indicador(DATA) 
  /KEEP=PL_buyer 
  /NULL=KEEP.

CTABLES /TABLE
DATA [SUM, ROWPCT.SUM PCT40.1]
BY indicador [C].


CTABLES /TABLE
indicador > DATA [SUM, COLPCT.SUM PCT40.1].


Javier Figueroa
Procesamiento de datos
Independiente



2013/10/9 Jon K Peck <[hidden email]>
Look at the PCOMPUTE subcommand in CTABLES.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: <a href="tel:720-342-5621" value="+17203425621" target="_blank">720-342-5621




From:        Ketty Tanizar Noonan <[hidden email]>
To:        [hidden email],
Date:        10/09/2013 02:23 PM
Subject:        [SPSSX-L] Custom table: Column % based on SUM
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hello,


How can I calculate Col % based on SUM?


This is the syntax I used:


CTABLES  /TABLE 
PL1_vol [SUM, COLPCT.SUM PCT40.1] + Dole1_vol [SUM, COLPCT.SUM PCT40.1] + AO1_vol [SUM,COLPCT.SUM PCT40.1] 
BY PL_buyer [C] .

This is what I got from running the syntax:

                                       PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        100%
Dole1_vol          40                        100%
AO1_vol             30                        100%


This is what I am looking for. Notice the Col Sum % sums to 100%.

                                  PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        30%
Dole1_vol          40                        40%
AO1_vol             30                        30%


Thanks!

Ketty



--
Javier Figueroa
Procesamiento y Análisis de bases de datos

Reply | Threaded
Open this post in threaded view
|

Re: Custom table: Column % based on SUM

Manoj Arora (DEL/Abacus Analytics)
In reply to this post by Jon K Peck

How PCOMPUTE Command will help because I have gone thru the PCOMPUTE command and it creates new variable.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: Thursday, October 10, 2013 1:57 AM
To: [hidden email]
Subject: Re: Custom table: Column % based on SUM

 

Look at the PCOMPUTE subcommand in CTABLES.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Ketty Tanizar Noonan <[hidden email]>
To:        [hidden email],
Date:        10/09/2013 02:23 PM
Subject:        [SPSSX-L] Custom table: Column % based on SUM
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





Hello,


How can I calculate Col % based on SUM?


This is the syntax I used:


CTABLES  /TABLE 
PL1_vol [SUM, COLPCT.SUM PCT40.1] + Dole1_vol [SUM, COLPCT.SUM PCT40.1] + AO1_vol [SUM,COLPCT.SUM PCT40.1] 
BY PL_buyer [C] .

This is what I got from running the syntax:

                                       PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        100%
Dole1_vol          40                        100%
AO1_vol             30                        100%


This is what I am looking for. Notice the Col Sum % sums to 100%.

                                  PL_Buyer
                           SUM                 COL SUM %
PL1_vol             30                        30%
Dole1_vol          40                        40%
AO1_vol             30                        30%


Thanks!

Ketty


http://www.imrbint.com/disclaimer.html