Date: Wed, 28 Nov 2001 07:30:46 -0600
Reply-To: "Peck, Jon" <peck@SPSS.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Peck, Jon" <peck@SPSS.COM>
Subject: Re: How to show 'ZERO' respondents in frequency
There is a much more straightforward way to accomplish the graphical part of
1. Create value label(s) for the categories (how else would SPSS know that
2. Use Igraph to create a bar chart: Graphs/Interactive/Bar
3. On the Options tab, make sure that the categorical variable you are using
is selected, and
uncheck the "Exclude empty categories" option.
To get a frequency table showing the empty categories, another approach is
to compute a new variable, say catvar, that is zero for all existing cases;
then enter one new case for each category that might be missing, assigning
the new variable the value 1. Then, using Table of Frequencies, put catvar
in the "separate tables" box. Then just use the top layer of the output.
We should make this easier for tables, as it already is in Igraph, but this
From: Raynald Levesque [mailto:rlevesque@VIDEOTRON.CA]
Sent: Tuesday, November 27, 2001 5:52 PM
Subject: Re: [SPSSX-L] How to show 'ZERO' respondents in frequency
The following solution is from SPSS AnswerNet:
Solution ID: 100001386
Product: SPSS Base
Question Type: Graphics
Question Subtype: Creation
Blank bar for unselected category
I have a categorical variable which I would like to display in a
bar chart. However, one of my categories was not selected by any
of my respondents. I can generate a frequency distribution and
bar chart for this variable, but the unselected category is not
included. How can I both generate a frequency distribution to
show a zero count for this category, as well as generate a bar
chart which also reflects a zero frequency?
This is not a hard project. First, you'll need to create a constant
with a value of 1 to weight the cases in the data set by. After you
create that constant, save the data file. Then, create another data set
with a DATA LIST command. This new file will have only one case.
This case will contain the variable you wish to chart (with the value
that you wish to include in the chart) and the weight variable. The
weight variable should have a very small value, like .00001.
Then, merge this data set with the original, WEIGHT BY weight
variable, and then generate the chart either through the
FREQUENCIES command, or with GRAPH. You'll get a frequency of 0
for that value, and the resultant bar chart will have a "blank"
space for the bar.
The following sample job is illustrative:
* Create a sample data set.
LOOP #I = 1 TO 100.
COMPUTE x = (TRUNC(UNIFORM(3)) + 1).
END INPUT PROGRAM.
* Compute the weight variable.
COMPUTE weight = 1.
SAVE OUTFILE = 'TMP.SAV'.
* Create a new file to merge with the original data.
DATA LIST /x 1 weight 3-8.
* Merge the data.
ADD FILES /FILE=*
* Weight the data.
BY weight .
* Generate the chart, here done with the FREQUENCIES command.
FREQUENCIES VARIABLES=x /BARCHART FREQ.
Raynald Levesque firstname.lastname@example.org
Visit My SPSS Pages: http://pages.infinit.net/rlevesqu/index.htm
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Sent: Tuesday, November 27, 2001 3:29 PM
Subject: How to show 'ZERO' respondents in frequency
I am trying to run a simple frequency. The variable has a category from 1
(strongly disagree) through 7 (strongly agree) and category 1 has 0
respondents. I noticed that the SPSS output does not show the category if
the corresponding category has 0 respondents. Is there any way I can force
the output to show that the category 'strongly disagree' has 0 respondent?
Research Data Analyst
Center for Prevention Research and Development
Champaign, IL 61820