How to get empty categories to print on a bar graph

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

How to get empty categories to print on a bar graph

Paul Jeffries-2
I had a number of subjects rate items on a 7 point scale.  Two of the rating labels, 1 and 3, were not used by any of the subjects.  I am now trying to create a bar graph showing subject counts for each rating.  I want all seven rating labels to appear even the two that were not used.  How can I get the empty labels to appear on the x axis.

All suggestions are appreciated,
Paul

Paul W. Jeffries
Department of Psychology
Washington & Jefferson College
60 South Lincoln Street
Washington, PA 15301
Email:  [hidden email]
Ph.:  724 503 1001 x3363
Fx.:   724 228 3802

=====================
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: How to get empty categories to print on a bar graph

ViAnn Beadle
As long as value labels are defined, the GGRAPH procedure will display them.
Use Chart Builder to create a chart and inspect the GPL generated looking at
the include() function on the SCALE statement for categorical variables.
Here's a simple example:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=usintl COUNT()[name="COUNT"]
MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: usintl=col(source(s), name("usintl"), unit.category())
  DATA: COUNT=col(source(s), name("COUNT"))
  GUIDE: axis(dim(1), label("Take Active Part in World Affairs"))
  GUIDE: axis(dim(2), label("Count"))
  SCALE: cat(dim(1), include("1", "2"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: interval(position(usintl*COUNT), shape.interior(shape.square))
END GPL.

Values 1 and 2 are always forced to the X axis.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Paul Jeffries
Sent: Thursday, March 24, 2011 4:32 PM
To: [hidden email]
Subject: How to get empty categories to print on a bar graph

I had a number of subjects rate items on a 7 point scale.  Two of the rating
labels, 1 and 3, were not used by any of the subjects.  I am now trying to
create a bar graph showing subject counts for each rating.  I want all seven
rating labels to appear even the two that were not used.  How can I get the
empty labels to appear on the x axis.

All suggestions are appreciated,
Paul

Paul W. Jeffries
Department of Psychology
Washington & Jefferson College
60 South Lincoln Street
Washington, PA 15301
Email:  [hidden email]
Ph.:  724 503 1001 x3363
Fx.:   724 228 3802

=====================
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: How to get empty categories to print on a bar graph

Albert-Jan Roskam
Isn't it also possible to use the old trick of adding the missing categories to the dataset (i.e., additional records). Then, create a variable 'w', which has value 10**-9 for the newly added records, and 1 for the other records. Finally, weight by variable 'w' and make the graph or table you need.
 
Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: ViAnn Beadle <[hidden email]>
To: [hidden email]
Sent: Fri, March 25, 2011 12:19:48 AM
Subject: Re: [SPSSX-L] How to get empty categories to print on a bar graph

As long as value labels are defined, the GGRAPH procedure will display them.
Use Chart Builder to create a chart and inspect the GPL generated looking at
the include() function on the SCALE statement for categorical variables.
Here's a simple example:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=usintl COUNT()[name="COUNT"]
MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: usintl=col(source(s), name("usintl"), unit.category())
  DATA: COUNT=col(source(s), name("COUNT"))
  GUIDE: axis(dim(1), label("Take Active Part in World Affairs"))
  GUIDE: axis(dim(2), label("Count"))
  SCALE: cat(dim(1), include("1", "2"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: interval(position(usintl*COUNT), shape.interior(shape.square))
END GPL.

Values 1 and 2 are always forced to the X axis.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Paul Jeffries
Sent: Thursday, March 24, 2011 4:32 PM
To: [hidden email]
Subject: How to get empty categories to print on a bar graph

I had a number of subjects rate items on a 7 point scale.  Two of the rating
labels, 1 and 3, were not used by any of the subjects.  I am now trying to
create a bar graph showing subject counts for each rating.  I want all seven
rating labels to appear even the two that were not used.  How can I get the
empty labels to appear on the x axis.

All suggestions are appreciated,
Paul

Paul W. Jeffries
Department of Psychology
Washington & Jefferson College
60 South Lincoln Street
Washington, PA 15301
Email:  [hidden email]
Ph.:  724 503 1001 x3363
Fx.:  724 228 3802

=====================
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: How to get empty categories to print on a bar graph

Daniel J. Robertson
In reply to this post by Paul Jeffries-2
Define value labels for each of the seven rating categories (even 1 = '1' will work), set the measurement level to nominal, and run the bar graph. When I try it, empty categories are included on the axis.

--
Daniel Robertson
Senior Research and Planning Associate
Institutional Research and Planning
Cornell University / irp.cornell.edu

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Paul Jeffries
Sent: Thursday, March 24, 2011 6:32 PM
To: [hidden email]
Subject: [SPSSX-L] How to get empty categories to print on a bar graph

I had a number of subjects rate items on a 7 point scale.  Two of the rating labels, 1 and 3, were not used by any of the subjects.  I am now trying to create a bar graph showing subject counts for each rating.  I want all seven rating labels to appear even the two that were not used.  How can I get the empty labels to appear on the x axis.

All suggestions are appreciated,
Paul

Paul W. Jeffries
Department of Psychology
Washington & Jefferson College
60 South Lincoln Street
Washington, PA 15301
Email:  [hidden email]
Ph.:  724 503 1001 x3363
Fx.:   724 228 3802

=====================
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: How to get empty categories to print on a bar graph

ViAnn Beadle
In reply to this post by Albert-Jan Roskam

IMHO, that is such an awful kludge.

 

From: Albert-Jan Roskam [mailto:[hidden email]]
Sent: Friday, March 25, 2011 2:27 AM
To: ViAnn Beadle; [hidden email]
Subject: Re: [SPSSX-L] How to get empty categories to print on a bar graph

 

Isn't it also possible to use the old trick of adding the missing categories to the dataset (i.e., additional records). Then, create a variable 'w', which has value 10**-9 for the newly added records, and 1 for the other records. Finally, weight by variable 'w' and make the graph or table you need.

 

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

 


From: ViAnn Beadle <[hidden email]>
To: [hidden email]
Sent: Fri, March 25, 2011 12:19:48 AM
Subject: Re: [SPSSX-L] How to get empty categories to print on a bar graph

As long as value labels are defined, the GGRAPH procedure will display them.
Use Chart Builder to create a chart and inspect the GPL generated looking at
the include() function on the SCALE statement for categorical variables.
Here's a simple example:

GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=usintl COUNT()[name="COUNT"]
MISSING=LISTWISE
    REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: usintl=col(source(s), name("usintl"), unit.category())
  DATA: COUNT=col(source(s), name("COUNT"))
  GUIDE: axis(dim(1), label("Take Active Part in World Affairs"))
  GUIDE: axis(dim(2), label("Count"))
  SCALE: cat(dim(1), include("1", "2"))
  SCALE: linear(dim(2), include(0))
  ELEMENT: interval(position(usintl*COUNT), shape.interior(shape.square))
END GPL.

Values 1 and 2 are always forced to the X axis.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Paul Jeffries
Sent: Thursday, March 24, 2011 4:32 PM
To: [hidden email]
Subject: How to get empty categories to print on a bar graph

I had a number of subjects rate items on a 7 point scale.  Two of the rating
labels, 1 and 3, were not used by any of the subjects.  I am now trying to
create a bar graph showing subject counts for each rating.  I want all seven
rating labels to appear even the two that were not used.  How can I get the
empty labels to appear on the x axis.

All suggestions are appreciated,
Paul

Paul W. Jeffries
Department of Psychology
Washington & Jefferson College
60 South Lincoln Street
Washington, PA 15301
Email:  [hidden email]
Ph.:  724 503 1001 x3363
Fx.:  724 228 3802

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