Dummy variables to provide section labels in tables

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

Dummy variables to provide section labels in tables

Dennis Deck
Occasionly I produce tables to summarize the item results from a test or survey using MEANS (or SUMMARIZE).   To make the labeling more informative in a long list of items,  I create dummy variables with labels but missing values. These provide labels to mark the beginning of the next subscale (eg, "Scale 1: School Policies") in the table.   However, MEANS (and SUMMARIZE) now drop any fields with no values.  

* Example of approach that no longer works .
COMPUTE Scale1 = $sysmis .
COMPUTE Scale2 = $sysmis .
VARIABLE LABELS
   Scale1  'Scale 1 Items'
   Scale2  'Scale 2 Items'  .
MEANS  
   Tables= Scale1 Item01 to Item20
                Scale2 Item21 to Item40   by Group  
  /Cells= mean  .

I tried specifying /Missing=Include but only got the warning message that those fields had no data and no table.  
I believe that this indicates an error in the behavior of /Missing=Include .



Dennis Deck, PhD
RMC Research Corporation
111 SW Columbia Street, Suite 1200
Portland, Oregon 97201-5843
voice: 503-223-8248 x715
voice: 800-788-1887 x715
fax:  503-223-8248
[hidden email]



Dennis Deck, PhD
RMC Research Corporation
111 SW Columbia Street, Suite 1200
Portland, Oregon 97201-5843
voice: 503-223-8248 x715
voice: 800-788-1887 x715
fax:  503-223-8248
[hidden email]

====================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: Dummy variables to provide section labels in tables

Richard Ristow
At 07:07 PM 3/18/2008, Dennis Deck wrote:

>Occasionally I produce tables to summarize the item results from a
>test or survey using MEANS (or SUMMARIZE).   To make the labeling
>more informative in a long list of items,  I create dummy variables
>with labels but missing values. These provide labels to mark the
>beginning of the next subscale (eg, "Scale 1: School Policies") in
>the table.   However, MEANS (and SUMMARIZE) now drop any fields with
>no values.
>
>* Example of approach that no longer works .
>COMPUTE Scale1 = $sysmis .
>COMPUTE Scale2 = $sysmis .
>VARIABLE LABELS
>    Scale1  'Scale 1 Items'
>    Scale2  'Scale 2 Items'  .
>MEANS
>    Tables= Scale1 Item01 to Item20
>                 Scale2 Item21 to Item40   by Group
>   /Cells= mean  .

How about this work-around? It's draft output (WRR:not saved
separately), which I've edited some, to be shorter and clearer.


COMPUTE Scale1 = $sysmis .
COMPUTE Scale2 = $sysmis .
IF $CASENUM EQ 1 Scale1=0  /* Added as work-around */.
IF $CASENUM EQ 1 Scale2=0  /* Added as work-around */.
VARIABLE LABELS
    Scale1  'Scale 1 Items'
    Scale2  'Scale 2 Items'  .
MEANS
    Tables= Scale1 Itm1 to Itm4
            Scale2 Itm5 to Itm8   by Group
   /Cells= mean  .

Means
|-----------------------------|---------------------------|
|Output Created               |18-MAR-2008 23:44:25       |
|-----------------------------|---------------------------|
Case Processing Summary
|---------------|--------------------------------------------|
|               |Cases                                       |
|               |---------------|---------------|------------|
|               |Included       |Excluded       |Total       |
|               |-------|-------|-------|-------|----|-------|
|               |N      |Percent|N      |Percent|N   |Percent|
|---------------|-------|-------|-------|-------|----|-------|
|Scale1  Scale 1|1      |3.3%   |29     |96.7%  |30  |100.0% |
|Items  * Group |       |       |       |       |    |       |
|---------------|-------|-------|-------|-------|----|-------|
|Itm1  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm2  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm3  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm4  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|---------------|-------|-------|-------|-------|----|-------|
|Scale2  Scale 2|1      |3.3%   |29     |96.7%  |30  |100.0% |
|Items  * Group |       |       |       |       |    |       |
|---------------|-------|-------|-------|-------|----|-------|
|Itm5  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm6  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm7  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm8  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|---------------|-------|-------|-------|-------|----|-------|

Report
Mean
|-----|-------|----|----|----|----|-------|----|----|----|----|
|Group|Scale1 |Itm1|Itm2|Itm3|Itm4|Scale2 |Itm5|Itm6|Itm7|Itm8|
|     |Scale 1|    |    |    |    |Scale 2|    |    |    |    |
|     |Items  |    |    |    |    |Items  |    |    |    |    |
|-----|-------|----|----|----|----|-------|----|----|----|----|
|01   |.0000  |3.00|3.25|2.58|3.67|.0000  |3.00|2.75|3.33|3.00|
|-----|-------|----|----|----|----|-------|----|----|----|----|
|02   |       |2.63|2.63|3.13|2.13|       |3.25|2.63|2.38|3.50|
|-----|-------|----|----|----|----|-------|----|----|----|----|
|03   |       |3.30|3.00|2.80|3.10|       |3.10|3.50|2.20|3.10|
|-----|-------|----|----|----|----|-------|----|----|----|----|
|Total|.0000  |3.00|3.00|2.80|3.07|.0000  |3.10|2.97|2.70|3.17|
|-----|-------|----|----|----|----|-------|----|----|----|----|

===================
APPENDIX: Test data
===================
*  ................................................................. .
*  .................   Test data               ..................... .
SET RNG = MT       /* 'Mersenne twister' random number generator  */ .
SET MTINDEX = 6920 /*  Providence, RI telephone book              */ .

NEW FILE.
INPUT PROGRAM.
.  NUMERIC CaseID (N3).
.  LEAVE   CaseID.
.  NUMERIC Group  (N2).
.  NUMERIC Itm1 TO Itm8 (F2).
.  VECTOR  ITEM
           =Itm1 TO Itm8.
.  LOOP    CaseID = 1 TO 30.
.     COMPUTE Group = TRUNC(RV.UNIFORM(1,4)).
.     LOOP #ItemNum = 1 TO 8.
.        COMPUTE ITEM(#ItemNum) = TRUNC(RV.UNIFORM(1,6)).
.     END LOOP.
.     END CASE.
.  END LOOP.
END FILE.
END INPUT PROGRAM.

LIST.


List
|-----------------------------|---------------------------|
|Output Created               |18-MAR-2008 23:44:24       |
|-----------------------------|---------------------------|
CaseID Group Itm1 Itm2 Itm3 Itm4 Itm5 Itm6 Itm7 Itm8

   001    01    3    2    5    4    1    1    2    1
   002    02    3    5    2    2    1    5    2    5
   003    01    1    2    2    3    1    4    5    4
   004    02    1    2    5    1    5    5    1    3
   005    02    2    2    3    4    2    2    4    4
   006    03    3    3    3    1    3    2    1    5
   007    01    2    3    2    5    3    5    1    3
   008    01    4    4    3    4    1    1    1    3
   009    02    4    2    2    1    3    3    1    3
   010    02    4    1    5    4    5    2    4    5
   011    02    2    1    2    2    5    1    4    4
   012    03    3    3    1    4    4    3    4    3
   013    01    3    5    2    3    5    5    5    5
   014    02    2    4    4    1    2    2    1    2
   015    03    2    4    1    2    3    5    2    5
   016    03    2    4    3    4    3    2    2    2
   017    03    5    3    3    4    4    5    2    4
   018    01    2    4    1    3    5    1    4    5
   019    01    3    4    1    5    3    1    4    3
   020    01    4    1    3    5    1    3    4    3
   021    01    2    2    2    4    5    3    4    1
   022    03    4    3    5    2    1    4    1    1
   023    03    5    3    3    5    4    5    2    5
   024    01    4    5    3    4    4    1    2    5
   025    03    3    4    2    3    3    5    2    1
   026    02    3    4    2    2    3    1    2    2
   027    03    5    2    5    1    4    3    2    3
   028    01    5    2    3    1    4    3    3    2
   029    01    3    5    4    3    3    5    5    1
   030    03    1    1    2    5    2    1    4    2

Number of cases read:  30    Number of cases listed:  30

=====================
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: Dummy variables to provide section labels in tables

Dennis Deck
Thanks Richard.

That creates the dummy variables all right.
Unfortunately there is no way to hide the Scale1/Scale2 means of zero,
something I was trying to avoid.

These would, however, serve as placeholders that could be fixed with a
manual edit.
I may be able to a) hide these values using FORMATS or b) search and
replace in Word during final editing.

  Dennis

-----Original Message-----
From: Richard Ristow [mailto:[hidden email]]
Sent: Tuesday, March 18, 2008 8:51 PM
To: Dennis Deck; [hidden email]
Subject: Re: Dummy variables to provide section labels in tables

At 07:07 PM 3/18/2008, Dennis Deck wrote:

>Occasionally I produce tables to summarize the item results from a
>test or survey using MEANS (or SUMMARIZE).   To make the labeling
>more informative in a long list of items,  I create dummy variables
>with labels but missing values. These provide labels to mark the
>beginning of the next subscale (eg, "Scale 1: School Policies") in
>the table.   However, MEANS (and SUMMARIZE) now drop any fields with
>no values.
>
>* Example of approach that no longer works .
>COMPUTE Scale1 = $sysmis .
>COMPUTE Scale2 = $sysmis .
>VARIABLE LABELS
>    Scale1  'Scale 1 Items'
>    Scale2  'Scale 2 Items'  .
>MEANS
>    Tables= Scale1 Item01 to Item20
>                 Scale2 Item21 to Item40   by Group
>   /Cells= mean  .

How about this work-around? It's draft output (WRR:not saved
separately), which I've edited some, to be shorter and clearer.


COMPUTE Scale1 = $sysmis .
COMPUTE Scale2 = $sysmis .
IF $CASENUM EQ 1 Scale1=0  /* Added as work-around */.
IF $CASENUM EQ 1 Scale2=0  /* Added as work-around */.
VARIABLE LABELS
    Scale1  'Scale 1 Items'
    Scale2  'Scale 2 Items'  .
MEANS
    Tables= Scale1 Itm1 to Itm4
            Scale2 Itm5 to Itm8   by Group
   /Cells= mean  .

Means
|-----------------------------|---------------------------|
|Output Created               |18-MAR-2008 23:44:25       |
|-----------------------------|---------------------------|
Case Processing Summary
|---------------|--------------------------------------------|
|               |Cases                                       |
|               |---------------|---------------|------------|
|               |Included       |Excluded       |Total       |
|               |-------|-------|-------|-------|----|-------|
|               |N      |Percent|N      |Percent|N   |Percent|
|---------------|-------|-------|-------|-------|----|-------|
|Scale1  Scale 1|1      |3.3%   |29     |96.7%  |30  |100.0% |
|Items  * Group |       |       |       |       |    |       |
|---------------|-------|-------|-------|-------|----|-------|
|Itm1  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm2  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm3  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm4  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|---------------|-------|-------|-------|-------|----|-------|
|Scale2  Scale 2|1      |3.3%   |29     |96.7%  |30  |100.0% |
|Items  * Group |       |       |       |       |    |       |
|---------------|-------|-------|-------|-------|----|-------|
|Itm5  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm6  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm7  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|Itm8  * Group  |30     |100.0% |0      |.0%    |30  |100.0% |
|---------------|-------|-------|-------|-------|----|-------|

Report
Mean
|-----|-------|----|----|----|----|-------|----|----|----|----|
|Group|Scale1 |Itm1|Itm2|Itm3|Itm4|Scale2 |Itm5|Itm6|Itm7|Itm8|
|     |Scale 1|    |    |    |    |Scale 2|    |    |    |    |
|     |Items  |    |    |    |    |Items  |    |    |    |    |
|-----|-------|----|----|----|----|-------|----|----|----|----|
|01   |.0000  |3.00|3.25|2.58|3.67|.0000  |3.00|2.75|3.33|3.00|
|-----|-------|----|----|----|----|-------|----|----|----|----|
|02   |       |2.63|2.63|3.13|2.13|       |3.25|2.63|2.38|3.50|
|-----|-------|----|----|----|----|-------|----|----|----|----|
|03   |       |3.30|3.00|2.80|3.10|       |3.10|3.50|2.20|3.10|
|-----|-------|----|----|----|----|-------|----|----|----|----|
|Total|.0000  |3.00|3.00|2.80|3.07|.0000  |3.10|2.97|2.70|3.17|
|-----|-------|----|----|----|----|-------|----|----|----|----|

===================
APPENDIX: Test data
===================
*  ................................................................. .
*  .................   Test data               ..................... .
SET RNG = MT       /* 'Mersenne twister' random number generator  */ .
SET MTINDEX = 6920 /*  Providence, RI telephone book              */ .

NEW FILE.
INPUT PROGRAM.
.  NUMERIC CaseID (N3).
.  LEAVE   CaseID.
.  NUMERIC Group  (N2).
.  NUMERIC Itm1 TO Itm8 (F2).
.  VECTOR  ITEM
           =Itm1 TO Itm8.
.  LOOP    CaseID = 1 TO 30.
.     COMPUTE Group = TRUNC(RV.UNIFORM(1,4)).
.     LOOP #ItemNum = 1 TO 8.
.        COMPUTE ITEM(#ItemNum) = TRUNC(RV.UNIFORM(1,6)).
.     END LOOP.
.     END CASE.
.  END LOOP.
END FILE.
END INPUT PROGRAM.

LIST.


List
|-----------------------------|---------------------------|
|Output Created               |18-MAR-2008 23:44:24       |
|-----------------------------|---------------------------|
CaseID Group Itm1 Itm2 Itm3 Itm4 Itm5 Itm6 Itm7 Itm8

   001    01    3    2    5    4    1    1    2    1
   002    02    3    5    2    2    1    5    2    5
   003    01    1    2    2    3    1    4    5    4
   004    02    1    2    5    1    5    5    1    3
   005    02    2    2    3    4    2    2    4    4
   006    03    3    3    3    1    3    2    1    5
   007    01    2    3    2    5    3    5    1    3
   008    01    4    4    3    4    1    1    1    3
   009    02    4    2    2    1    3    3    1    3
   010    02    4    1    5    4    5    2    4    5
   011    02    2    1    2    2    5    1    4    4
   012    03    3    3    1    4    4    3    4    3
   013    01    3    5    2    3    5    5    5    5
   014    02    2    4    4    1    2    2    1    2
   015    03    2    4    1    2    3    5    2    5
   016    03    2    4    3    4    3    2    2    2
   017    03    5    3    3    4    4    5    2    4
   018    01    2    4    1    3    5    1    4    5
   019    01    3    4    1    5    3    1    4    3
   020    01    4    1    3    5    1    3    4    3
   021    01    2    2    2    4    5    3    4    1
   022    03    4    3    5    2    1    4    1    1
   023    03    5    3    3    5    4    5    2    5
   024    01    4    5    3    4    4    1    2    5
   025    03    3    4    2    3    3    5    2    1
   026    02    3    4    2    2    3    1    2    2
   027    03    5    2    5    1    4    3    2    3
   028    01    5    2    3    1    4    3    3    2
   029    01    3    5    4    3    3    5    5    1
   030    03    1    1    2    5    2    1    4    2

Number of cases read:  30    Number of cases listed:  30

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