Generating Summary Tables in SPSS

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

Generating Summary Tables in SPSS

Manoj Arora (DEL/Abacus Analytics)

Hi,

 

I have 10 questions with 5 points data and I want to generate the summary table like given below. Please find below the data set.

 

st1

st2

st3

st4

st5

st6

st7

st8

st9

st10

4

4

8

4

1

5

5

5

5

4

3

3

9

3

2

4

4

4

4

5

5

3

3

3

3

3

3

3

3

5

5

4

3

4

4

2

2

2

2

5

5

4

4

4

5

9

9

9

9

4

4

4

5

4

8

9

9

9

9

8

8

4

5

4

9

8

8

8

8

9

8

3

5

3

1

3

3

3

3

3

8

4

5

4

2

4

4

4

4

2

9

3

2

3

3

4

4

4

4

1

9

4

2

4

4

4

4

4

4

2

1

4

2

4

5

5

5

5

5

3

2

3

1

4

8

5

5

5

5

4

3

3

1

4

9

5

5

5

5

3

1

4

1

4

1

2

2

2

2

4

2

3

3

3

2

2

2

2

2

3

3

3

3

2

3

1

1

1

1

4

1

3

3

3

4

1

1

1

1

3

2

4

4

4

4

1

1

1

1

4

4

4

4

4

5

4

4

4

4

4

 

In this data codes

 

Poor                      1

Fair                         2

Good                     3

V Good                 4

Excellent              5

DK/CS                   8

Refused               9

 

 

I want the summary tables like this. This is the %age of 4 & 5 coded on each statement excluding the count for 8, 9.

 

St1  (4 + 5)

40

St2 (4 + 5)

55

St3 (4 + 5)

39

St4 (4 + 5)

65

St5 (4 + 5)

44

St6 (4 + 5)

53

St7 (4 + 5)

53

St8 (4 + 5)

53

St9 (4 + 5)

53

St10 (4 + 5)

56

 

 

 

 

Any help on this will be appreciated

 

 

Thanks

Manoj

 

 

 



Kantar Disclaimer ===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Pushpender Nath
hi Manoj
Normally for such data processing, I use VBA in excel. It should be easy there.



Regards

Dr. Pushpender Nath

On 30 September 2015 at 11:23, Arora, Manoj (IMDLR) <[hidden email]> wrote:

Hi,

 

I have 10 questions with 5 points data and I want to generate the summary table like given below. Please find below the data set.

 

st1

st2

st3

st4

st5

st6

st7

st8

st9

st10

4

4

8

4

1

5

5

5

5

4

3

3

9

3

2

4

4

4

4

5

5

3

3

3

3

3

3

3

3

5

5

4

3

4

4

2

2

2

2

5

5

4

4

4

5

9

9

9

9

4

4

4

5

4

8

9

9

9

9

8

8

4

5

4

9

8

8

8

8

9

8

3

5

3

1

3

3

3

3

3

8

4

5

4

2

4

4

4

4

2

9

3

2

3

3

4

4

4

4

1

9

4

2

4

4

4

4

4

4

2

1

4

2

4

5

5

5

5

5

3

2

3

1

4

8

5

5

5

5

4

3

3

1

4

9

5

5

5

5

3

1

4

1

4

1

2

2

2

2

4

2

3

3

3

2

2

2

2

2

3

3

3

3

2

3

1

1

1

1

4

1

3

3

3

4

1

1

1

1

3

2

4

4

4

4

1

1

1

1

4

4

4

4

4

5

4

4

4

4

4

 

In this data codes

 

Poor                      1

Fair                         2

Good                     3

V Good                 4

Excellent              5

DK/CS                   8

Refused               9

 

 

I want the summary tables like this. This is the %age of 4 & 5 coded on each statement excluding the count for 8, 9.

 

St1  (4 + 5)

40

St2 (4 + 5)

55

St3 (4 + 5)

39

St4 (4 + 5)

65

St5 (4 + 5)

44

St6 (4 + 5)

53

St7 (4 + 5)

53

St8 (4 + 5)

53

St9 (4 + 5)

53

St10 (4 + 5)

56

 

 

 

 

Any help on this will be appreciated

 

 

Thanks

Manoj

 

 

 



Kantar Disclaimer
===================== 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

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Jignesh Sutar
In reply to this post by Manoj Arora (DEL/Abacus Analytics)
You can use PCOMPUTE subcommand within CTABLES or alternatively, and also my personal preference, is to create a new set of dichotomous variables (treating them as SCALE variables in CTABLES) and then tabulate them using CTABLES.

Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Manoj Arora (DEL/Abacus Analytics)
you please post to the forum.

On 30 September 2015 at 08:53, Arora, Manoj (IMDLR) <[hidden email]> wrote:
Hi Jignesh,

Thanks for your reply.

We can use the PCOMPUTE command but in that case we can't hide any category. In the below syntax I have created 2 categories Top-2 & Bot-3 and at the time of generation of tables it will show both the categories.

CTABLES
  /VLABELS VARIABLES=St1 St2 St3 St4 St5 St6 St7 st8 st9 st10 DISPLAY=LABEL
  /PCOMPUTE &cat1 = EXPR([4] + [5])
  /PPROPERTIES &cat1 LABEL = "Top-2" FORMAT=COUNT F40.0 HIDESOURCECATS=YES
  /PCOMPUTE &cat2 = EXPR([1] + [2] + [3])
  /PPROPERTIES &cat2 LABEL = "Bot-3" FORMAT=COUNT F40.0 HIDESOURCECATS=YES
  /TABLE St1 [C][COLPCT.COUNT PCT40.1] + St2 [C][COLPCT.COUNT PCT40.1] + St3 [C][COLPCT.COUNT PCT40.1] + St4
    [C][COLPCT.COUNT PCT40.1] + St5 [C][COLPCT.COUNT PCT40.1] + St6 [C][COLPCT.COUNT PCT40.1] + St7 [C][COLPCT.COUNT PCT40.1]
 + St8 [C][COLPCT.COUNT PCT40.1]
 + St9 [C][COLPCT.COUNT PCT40.1]
 + St10 [C][COLPCT.COUNT PCT40.1]
  /SLABELS POSITION=ROW
  /CATEGORIES VARIABLES=St1 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St2 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St3 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St4 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St5 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St6 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St7 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St8 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St9 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
  /CATEGORIES VARIABLES=St10 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE.



Regards
Manoj


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jignesh Sutar
Sent: Wednesday, September 30, 2015 1:18 PM
To: [hidden email]
Subject: Re: Generating Summary Tables in SPSS

You can use PCOMPUTE subcommand within CTABLES or alternatively, and also my personal preference, is to create a new set of dichotomous variables (treating them as SCALE variables in CTABLES) and then tabulate them using CTABLES.





--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Generating-Summary-Tables-in-SPSS-tp5730700p5730703.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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Jon K Peck
The PPROPERTIES subcommand allows you to hide categories used in a PCOMPUTE.  Also, the OUTPUT MODIFY command allows you to hide or otherwise format arbitrary rows or columns in a table.


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




From:        "Arora, Manoj (IMDLR)" <[hidden email]>
To:        [hidden email]
Date:        09/30/2015 02:00 AM
Subject:        Re: [SPSSX-L] Generating Summary Tables in SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




you please post to the forum.

On 30 September 2015 at 08:53, Arora, Manoj (IMDLR) <[hidden email]> wrote:
Hi Jignesh,

Thanks for your reply.

We can use the PCOMPUTE command but in that case we can't hide any category. In the below syntax I have created 2 categories Top-2 & Bot-3 and at the time of generation of tables it will show both the categories.

CTABLES
 /VLABELS VARIABLES=St1 St2 St3 St4 St5 St6 St7 st8 st9 st10 DISPLAY=LABEL
 /PCOMPUTE &cat1 = EXPR([4] + [5])
 /PPROPERTIES &cat1 LABEL = "Top-2" FORMAT=COUNT F40.0 HIDESOURCECATS=YES
 /PCOMPUTE &cat2 = EXPR([1] + [2] + [3])
 /PPROPERTIES &cat2 LABEL = "Bot-3" FORMAT=COUNT F40.0 HIDESOURCECATS=YES
 /TABLE St1 [C][COLPCT.COUNT PCT40.1] + St2 [C][COLPCT.COUNT PCT40.1] + St3 [C][COLPCT.COUNT PCT40.1] + St4
   [C][COLPCT.COUNT PCT40.1] + St5 [C][COLPCT.COUNT PCT40.1] + St6 [C][COLPCT.COUNT PCT40.1] + St7 [C][COLPCT.COUNT PCT40.1]
+ St8 [C][COLPCT.COUNT PCT40.1]
+ St9 [C][COLPCT.COUNT PCT40.1]
+ St10 [C][COLPCT.COUNT PCT40.1]
 /SLABELS POSITION=ROW
 /CATEGORIES VARIABLES=St1 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St2 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St3 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St4 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St5 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St6 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St7 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St8 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St9 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St10 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE.



Regards
Manoj


-----Original Message-----
From: SPSSX(r) Discussion [
[hidden email]] On Behalf Of Jignesh Sutar
Sent: Wednesday, September 30, 2015 1:18 PM
To: [hidden email]
Subject: Re: Generating Summary Tables in SPSS

You can use PCOMPUTE subcommand within CTABLES or alternatively, and also my personal preference, is to create a new set of dichotomous variables (treating them as SCALE variables in CTABLES) and then tabulate them using CTABLES.





--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Generating-Summary-Tables-in-SPSS-tp5730700p5730703.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

=====================
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



===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Richard Ristow
In reply to this post by Manoj Arora (DEL/Abacus Analytics)
At 01:53 AM 9/30/2015, Arora, Manoj (IMDLR) wrote:

>I have 10 questions with 5 [possible values, plus missing data] and
>I want to generate the summary table like this. This is the %age of
>4 & 5 coded on each statement excluding the count for 8, 9.
>
>St1  (4 + 5)    40
>St2  (4 + 5)    55
>St3  (4 + 5)    39
>St4  (4 + 5)    65
>St5  (4 + 5)    44
>St6  (4 + 5)    53
>St7  (4 + 5)    53
>St8  (4 + 5)    53
>St9  (4 + 5)    53
>St10 (4 + 5)    56

You've had various approaches posted. Another, possibly the simplest,
is to use AGGREGATE in native SPSS.  If you define 8 and 9 as
user-missing values for your input variables, the PIN function in
AGGREGATE gives you the results you want, admittedly not laid out as
you requested:

MISSING VALUES st1 TO st10 (8,9).

*  The following use of NOBREAK is not necessary in recent .
*  versions of SPSS:                                       .

TEMPORARY.
COMPUTE NoBreak = 1.
FORMATS NoBreak  (F2).

DATASET   DECLARE  Summary.
AGGREGATE OUTFILE= Summary
    /BREAK=NoBreak
    /ST1  TO ST10   = PIN (ST1 TO ST10,4,5).

DATASET   ACTIVATE Summary WINDOW=FRONT.
LIST /VARIABLES=ST1 TO ST10.

List
|-----------------------------|---------------------------|
|Output Created               |30-SEP-2015 23:45:42       |
|-----------------------------|---------------------------|
  [Summary]

   ST1   ST2   ST3   ST4   ST5   ST6   ST7   ST8   ST9  ST10

  40.0  55.0  38.9  65.0  43.8  52.9  52.9  52.9  52.9  55.6

Number of cases read:  1    Number of cases listed:  1


And you can then use VARSTOCASES to get a report in vertical form:

DATASET COPY     LongForm.
DATASET ACTIVATE LongForm WINDOW=FRONT.
VARSTOCASES  /MAKE Percent FROM ST1 TO ST10
  /INDEX = Name(Percent)
  /KEEP = NoBreak
  /NULL = KEEP.

Variables to Cases
Notes  [suppressed]
Generated Variables   [suppressed]
Processing Statistics [suppressed]

STRING  Range    (A7).
COMPUTE Range = '(4 - 5)'.

LIST /VARIABLES= Name Range Percent.

List
|-----------------------------|---------------------------|
|Output Created               |30-SEP-2015 23:45:43       |
|-----------------------------|---------------------------|
  [LongForm]

Name Range   Percent

ST1  (4 - 5)   40.0
ST2  (4 - 5)   55.0
ST3  (4 - 5)   38.9
ST4  (4 - 5)   65.0
ST5  (4 - 5)   43.8
ST6  (4 - 5)   52.9
ST7  (4 - 5)   52.9
ST8  (4 - 5)   52.9
ST9  (4 - 5)   52.9
ST10 (4 - 5)   55.6

Number of cases read:  10    Number of cases listed:  10
=======================================================
APPENDIX: Test data from original posting, and all code
=======================================================
*  C:\Documents and Settings\Richard\My Documents           .
*    \Technical\spssx-l\Z-2015\                             .
*    2015-09-30 Arora-Generating Summary Tables in SPSS.SPS .

*  In response to posting                                   .
*  Date:    Wed, 30 Sep 2015 05:53:52 +0000                 .
*  From:    "Arora, Manoj (IMDLR)" <[hidden email]>   .
*  Subject: Generating Summary Tables in SPSS               .
*  To:      [hidden email]                        .


*  "I have 10 questions with 5 [different response values, plus     .
*  missing values] points data and I want to generate the summary   .
*  table like this. This is the %age of 4 & 5 coded on each         .
*  statement excluding the count for 8, 9.                          .
*                                                                   .
*     St1 (4 + 5)   40   .
*     St2 (4 + 5)   55   .
*     St3 (4 + 5)   39   .
*     St4 (4 + 5)   65   .
*     St5 (4 + 5)   44   .
*     St6 (4 + 5)   53   .
*     St7 (4 + 5)   53   .
*     St8 (4 + 5)   53   .
*     St9 (4 + 5)   53   .
*     St10 (4 + 5)  56   .

DATA LIST LIST/
  st1   st2   st3   st4   st5   st6   st7   st8   st9   st10
  (10F3).
BEGIN DATA
   4     4     8     4     1     5     5     5     5     4
   3     3     9     3     2     4     4     4     4     5
   5     3     3     3     3     3     3     3     3     5
   5     4     3     4     4     2     2     2     2     5
   5     4     4     4     5     9     9     9     9     4
   4     4     5     4     8     9     9     9     9     8
   8     4     5     4     9     8     8     8     8     9
   8     3     5     3     1     3     3     3     3     3
   8     4     5     4     2     4     4     4     4     2
   9     3     2     3     3     4     4     4     4     1
   9     4     2     4     4     4     4     4     4     2
   1     4     2     4     5     5     5     5     5     3
   2     3     1     4     8     5     5     5     5     4
   3     3     1     4     9     5     5     5     5     3
   1     4     1     4     1     2     2     2     2     4
   2     3     3     3     2     2     2     2     2     3
   3     3     3     2     3     1     1     1     1     4
   1     3     3     3     4     1     1     1     1     3
   2     4     4     4     4     1     1     1     1     4
   4     4     4     4     5     4     4     4     4     4
END DATA.
DATASET NAME     TestData WINDOW=FRONT.

VALUE LABELS   st1 TO st10
   1  'Poor     '
   2  'Fair     '
   3  'Good     '
   4  'V Good   '
   5  'Excellent'
   8  'DK/CS    '
   9  'Refused  '.
MISSING VALUES st1 TO st10 (8,9).

LIST.

DATASET ACTIVATE TestData  WINDOW=FRONT.


*  The following code is to test AGGREGATE's handling of   .
*  missing values in PIN and FOUT.                         .

DATASET DECLARE  TestSumm.

*  The following use of NOBREAK is not necessary in recent .
*  versions of SPSS:                                       .
TEMPORARY.
COMPUTE NoBreak = 1.
FORMATS NoBreak  (F2).

NUMERIC st1nomsg st2nomsg (F3).
RECODE  st1      st2      (ELSE=COPY)
    INTO st1nomsg st2nomsg .

AGGREGATE OUTFILE=TestSumm
    /BREAK=NoBreak
    /     pc1 pc2 pc1nomsg pc2nomsg
    =PIN (st1 st2 st1nomsg st2nomsg,4,5)
    /     bs1 bs2 bs1nomsg bs2nomsg
    =FOUT(st1 st2 st1nomsg st2nomsg,8,9).

DATASET ACTIVATE   TestSumm WINDOW=FRONT.

LIST.

*  ................................................................ .
*  Code to solve the problem as posted                          ... .

DATASET ACTIVATE TestData  WINDOW=FRONT.

*  The following use of NOBREAK is not necessary in recent .
*  versions of SPSS:                                       .

TEMPORARY.
COMPUTE NoBreak = 1.
FORMATS NoBreak  (F2).

DATASET   DECLARE  Summary.
AGGREGATE OUTFILE= Summary
    /BREAK=NoBreak
    /ST1  TO ST10   = PIN (ST1 TO ST10,4,5).

DATASET   ACTIVATE Summary WINDOW=FRONT.

LIST /VARIABLES=ST1 TO ST10.

*  To format more like the original poster asked:

DATASET COPY     LongForm.
DATASET ACTIVATE LongForm WINDOW=FRONT.

VARSTOCASES  /MAKE Percent FROM ST1 TO ST10
  /INDEX = Name(Percent)
  /KEEP = NoBreak
  /NULL = KEEP.

STRING  Range    (A7).
COMPUTE Range = '(4 - 5)'.

LIST /VARIABLES= Name Range Percent.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Manoj Arora (DEL/Abacus Analytics)
Thanks for your input. But I want to generate the same using Custom Tables because I have to apply n number of top breaks with layers.

Regards
Manoj


-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Thursday, October 01, 2015 9:32 AM
To: Arora, Manoj (IMDLR); [hidden email]
Subject: Re: Generating Summary Tables in SPSS

At 01:53 AM 9/30/2015, Arora, Manoj (IMDLR) wrote:

>I have 10 questions with 5 [possible values, plus missing data] and I
>want to generate the summary table like this. This is the %age of
>4 & 5 coded on each statement excluding the count for 8, 9.
>
>St1  (4 + 5)    40
>St2  (4 + 5)    55
>St3  (4 + 5)    39
>St4  (4 + 5)    65
>St5  (4 + 5)    44
>St6  (4 + 5)    53
>St7  (4 + 5)    53
>St8  (4 + 5)    53
>St9  (4 + 5)    53
>St10 (4 + 5)    56

You've had various approaches posted. Another, possibly the simplest, is to use AGGREGATE in native SPSS.  If you define 8 and 9 as user-missing values for your input variables, the PIN function in AGGREGATE gives you the results you want, admittedly not laid out as you requested:

MISSING VALUES st1 TO st10 (8,9).

*  The following use of NOBREAK is not necessary in recent .
*  versions of SPSS:                                       .

TEMPORARY.
COMPUTE NoBreak = 1.
FORMATS NoBreak  (F2).

DATASET   DECLARE  Summary.
AGGREGATE OUTFILE= Summary
    /BREAK=NoBreak
    /ST1  TO ST10   = PIN (ST1 TO ST10,4,5).

DATASET   ACTIVATE Summary WINDOW=FRONT.
LIST /VARIABLES=ST1 TO ST10.

List
|-----------------------------|---------------------------|
|Output Created               |30-SEP-2015 23:45:42       |
|-----------------------------|---------------------------|
  [Summary]

   ST1   ST2   ST3   ST4   ST5   ST6   ST7   ST8   ST9  ST10

  40.0  55.0  38.9  65.0  43.8  52.9  52.9  52.9  52.9  55.6

Number of cases read:  1    Number of cases listed:  1


And you can then use VARSTOCASES to get a report in vertical form:

DATASET COPY     LongForm.
DATASET ACTIVATE LongForm WINDOW=FRONT.
VARSTOCASES  /MAKE Percent FROM ST1 TO ST10
  /INDEX = Name(Percent)
  /KEEP = NoBreak
  /NULL = KEEP.

Variables to Cases
Notes  [suppressed]
Generated Variables   [suppressed]
Processing Statistics [suppressed]

STRING  Range    (A7).
COMPUTE Range = '(4 - 5)'.

LIST /VARIABLES= Name Range Percent.

List
|-----------------------------|---------------------------|
|Output Created               |30-SEP-2015 23:45:43       |
|-----------------------------|---------------------------|
  [LongForm]

Name Range   Percent

ST1  (4 - 5)   40.0
ST2  (4 - 5)   55.0
ST3  (4 - 5)   38.9
ST4  (4 - 5)   65.0
ST5  (4 - 5)   43.8
ST6  (4 - 5)   52.9
ST7  (4 - 5)   52.9
ST8  (4 - 5)   52.9
ST9  (4 - 5)   52.9
ST10 (4 - 5)   55.6

Number of cases read:  10    Number of cases listed:  10
=======================================================
APPENDIX: Test data from original posting, and all code =======================================================
*  C:\Documents and Settings\Richard\My Documents           .
*    \Technical\spssx-l\Z-2015\                             .
*    2015-09-30 Arora-Generating Summary Tables in SPSS.SPS .

*  In response to posting                                   .
*  Date:    Wed, 30 Sep 2015 05:53:52 +0000                 .
*  From:    "Arora, Manoj (IMDLR)" <[hidden email]>   .
*  Subject: Generating Summary Tables in SPSS               .
*  To:      [hidden email]                        .


*  "I have 10 questions with 5 [different response values, plus     .
*  missing values] points data and I want to generate the summary   .
*  table like this. This is the %age of 4 & 5 coded on each         .
*  statement excluding the count for 8, 9.                          .
*                                                                   .
*     St1 (4 + 5)   40   .
*     St2 (4 + 5)   55   .
*     St3 (4 + 5)   39   .
*     St4 (4 + 5)   65   .
*     St5 (4 + 5)   44   .
*     St6 (4 + 5)   53   .
*     St7 (4 + 5)   53   .
*     St8 (4 + 5)   53   .
*     St9 (4 + 5)   53   .
*     St10 (4 + 5)  56   .

DATA LIST LIST/
  st1   st2   st3   st4   st5   st6   st7   st8   st9   st10
  (10F3).
BEGIN DATA
   4     4     8     4     1     5     5     5     5     4
   3     3     9     3     2     4     4     4     4     5
   5     3     3     3     3     3     3     3     3     5
   5     4     3     4     4     2     2     2     2     5
   5     4     4     4     5     9     9     9     9     4
   4     4     5     4     8     9     9     9     9     8
   8     4     5     4     9     8     8     8     8     9
   8     3     5     3     1     3     3     3     3     3
   8     4     5     4     2     4     4     4     4     2
   9     3     2     3     3     4     4     4     4     1
   9     4     2     4     4     4     4     4     4     2
   1     4     2     4     5     5     5     5     5     3
   2     3     1     4     8     5     5     5     5     4
   3     3     1     4     9     5     5     5     5     3
   1     4     1     4     1     2     2     2     2     4
   2     3     3     3     2     2     2     2     2     3
   3     3     3     2     3     1     1     1     1     4
   1     3     3     3     4     1     1     1     1     3
   2     4     4     4     4     1     1     1     1     4
   4     4     4     4     5     4     4     4     4     4
END DATA.
DATASET NAME     TestData WINDOW=FRONT.

VALUE LABELS   st1 TO st10
   1  'Poor     '
   2  'Fair     '
   3  'Good     '
   4  'V Good   '
   5  'Excellent'
   8  'DK/CS    '
   9  'Refused  '.
MISSING VALUES st1 TO st10 (8,9).

LIST.

DATASET ACTIVATE TestData  WINDOW=FRONT.


*  The following code is to test AGGREGATE's handling of   .
*  missing values in PIN and FOUT.                         .

DATASET DECLARE  TestSumm.

*  The following use of NOBREAK is not necessary in recent .
*  versions of SPSS:                                       .
TEMPORARY.
COMPUTE NoBreak = 1.
FORMATS NoBreak  (F2).

NUMERIC st1nomsg st2nomsg (F3).
RECODE  st1      st2      (ELSE=COPY)
    INTO st1nomsg st2nomsg .

AGGREGATE OUTFILE=TestSumm
    /BREAK=NoBreak
    /     pc1 pc2 pc1nomsg pc2nomsg
    =PIN (st1 st2 st1nomsg st2nomsg,4,5)
    /     bs1 bs2 bs1nomsg bs2nomsg
    =FOUT(st1 st2 st1nomsg st2nomsg,8,9).

DATASET ACTIVATE   TestSumm WINDOW=FRONT.

LIST.

*  ................................................................ .
*  Code to solve the problem as posted                          ... .

DATASET ACTIVATE TestData  WINDOW=FRONT.

*  The following use of NOBREAK is not necessary in recent .
*  versions of SPSS:                                       .

TEMPORARY.
COMPUTE NoBreak = 1.
FORMATS NoBreak  (F2).

DATASET   DECLARE  Summary.
AGGREGATE OUTFILE= Summary
    /BREAK=NoBreak
    /ST1  TO ST10   = PIN (ST1 TO ST10,4,5).

DATASET   ACTIVATE Summary WINDOW=FRONT.

LIST /VARIABLES=ST1 TO ST10.

*  To format more like the original poster asked:

DATASET COPY     LongForm.
DATASET ACTIVATE LongForm WINDOW=FRONT.

VARSTOCASES  /MAKE Percent FROM ST1 TO ST10
  /INDEX = Name(Percent)
  /KEEP = NoBreak
  /NULL = KEEP.

STRING  Range    (A7).
COMPUTE Range = '(4 - 5)'.

LIST /VARIABLES= Name Range Percent.

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

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

Hi,

 

I have never used Output modify command earlier. I am trying to understand how it works. Meanwhile I want to hide the rows with Bot-3 , could you please help on this?

 

Thanks & Regards

Manoj

 

 

 

All

1.00 Total

Base

1.00 Total

Count

150

Q22B_1-Ease of logging in to the dealer management system-

Top-2

Column N %

47.0%

Bot-3

Column N %

53.0%

Q22B_2-Look and feel in terms of attractiveness, layout, etc.-

Top-2

Column N %

44.6%

Bot-3

Column N %

55.4%

Q22B_3-Ease of using the system-

Top-2

Column N %

35.6%

Bot-3

Column N %

64.4%

Q22B_4-Security of the dealer management system-

Top-2

Column N %

41.0%

Bot-3

Column N %

59.0%

Q22B_5-Ease of using and accessing DMS across multiple locations-

Top-2

Column N %

44.5%

Bot-3

Column N %

55.5%

Q22B_6-Cost of DMS installation -

Top-2

Column N %

26.5%

Bot-3

Column N %

73.5%

Q22B_7-Cost of recurring expenses on DMS-

Top-2

Column N %

20.4%

Bot-3

Column N %

79.6%

 

 

From: Jon K Peck [mailto:[hidden email]]
Sent: Wednesday, September 30, 2015 5:56 PM
To: Arora, Manoj (IMDLR)
Cc: [hidden email]
Subject: Re: [SPSSX-L] Generating Summary Tables in SPSS

 

The PPROPERTIES subcommand allows you to hide categories used in a PCOMPUTE.  Also, the OUTPUT MODIFY command allows you to hide or otherwise format arbitrary rows or columns in a table.


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




From:        "Arora, Manoj (IMDLR)" <[hidden email]>
To:        [hidden email]
Date:        09/30/2015 02:00 AM
Subject:        Re: [SPSSX-L] Generating Summary Tables in SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





you please post to the forum.

On 30 September 2015 at 08:53, Arora, Manoj (IMDLR) <[hidden email]> wrote:
Hi Jignesh,

Thanks for your reply.

We can use the PCOMPUTE command but in that case we can't hide any category. In the below syntax I have created 2 categories Top-2 & Bot-3 and at the time of generation of tables it will show both the categories.

CTABLES
 /VLABELS VARIABLES=St1 St2 St3 St4 St5 St6 St7 st8 st9 st10 DISPLAY=LABEL
 /PCOMPUTE &cat1 = EXPR([4] + [5])
 /PPROPERTIES &cat1 LABEL = "Top-2" FORMAT=COUNT F40.0 HIDESOURCECATS=YES
 /PCOMPUTE &cat2 = EXPR([1] + [2] + [3])
 /PPROPERTIES &cat2 LABEL = "Bot-3" FORMAT=COUNT F40.0 HIDESOURCECATS=YES
 /TABLE St1 [C][COLPCT.COUNT PCT40.1] + St2 [C][COLPCT.COUNT PCT40.1] + St3 [C][COLPCT.COUNT PCT40.1] + St4
   [C][COLPCT.COUNT PCT40.1] + St5 [C][COLPCT.COUNT PCT40.1] + St6 [C][COLPCT.COUNT PCT40.1] + St7 [C][COLPCT.COUNT PCT40.1]
+ St8 [C][COLPCT.COUNT PCT40.1]
+ St9 [C][COLPCT.COUNT PCT40.1]
+ St10 [C][COLPCT.COUNT PCT40.1]
 /SLABELS POSITION=ROW
 /CATEGORIES VARIABLES=St1 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St2 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St3 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St4 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St5 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St6 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St7 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St8 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St9 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE
 /CATEGORIES VARIABLES=St10 [1, 2, 3, &cat1, &cat2, 4, 5] EMPTY=EXCLUDE.



Regards
Manoj


-----Original Message-----
From: SPSSX(r) Discussion [
[hidden email]] On Behalf Of Jignesh Sutar
Sent: Wednesday, September 30, 2015 1:18 PM
To: [hidden email]
Subject: Re: Generating Summary Tables in SPSS

You can use PCOMPUTE subcommand within CTABLES or alternatively, and also my personal preference, is to create a new set of dichotomous variables (treating them as SCALE variables in CTABLES) and then tabulate them using CTABLES.





--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Generating-Summary-Tables-in-SPSS-tp5730700p5730703.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

=====================
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


===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Jignesh Sutar
Try something like this:


spssinc modify tables subtype="'custom table'"
select="Bot-3" dimension= rows level = -2
process = preceding hide=true.
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

jonpedersen
Hi,
You may try:
recode st1 to st10 (1 thru 3=0) (4 thru 5=100) (else =999) into sta1 to sta10.
missing values sta1 to sta10 (999).
variables levels sta1 to sta10 (scale).
ctables
/table (sta1+sta2+sta3+sta4+sta5+sta6+sta7+sta8+sta10)  [mean,F3.0,"Percent 4 and 5"].
best
Jon
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

Jignesh Sutar
Just a slight correction to Jon solutions as the OP required the % as base of Total respondents (as I had understood) in the sample (so including those DK/Refused) and also providing an example to how you can use this approach to still give a base size in the top row of the table.

compute Base0 = 1                                /* Count all respondents in base */ .
recode st1 to st10 (1 thru 3=0) (4 thru 5=100) (else =0) into sta1 to sta10.
variables levels sta1 to sta10 (scale).
ctables
/table (Base0 + sta1+sta2+sta3+sta4+sta5+sta6+sta7+sta8+sta10)[s] [mean,F3.0,"Percent 4 and 5"].
Reply | Threaded
Open this post in threaded view
|

Re: Generating Summary Tables in SPSS

jagadishpchary
In reply to this post by Manoj Arora (DEL/Abacus Analytics)
Hi Manoj,

I was reading your post regarding the "Generating Summary Tables in SPSS".
Even i need to generate summary tables for multiple questions in CTABLES as
I have cross breaks. The question is, I am to generate frequencies perfectly
however unable to generate the % ages. May I know if you have any solution
on this.

Many thanks for your help.

Regards,
Jagadish






--
Sent from: http://spssx-discussion.1045642.n5.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