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
this task.
1. Create value label(s) for the categories (how else would SPSS know that
they exist).
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
will work.
Regards,
Jon Peck
-----Original Message-----
From: Raynald Levesque [mailto:rlevesque@VIDEOTRON.CA]
Sent: Tuesday, November 27, 2001 5:52 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Re: [SPSSX-L] How to show 'ZERO' respondents in frequency
Hi
The following solution is from SPSS AnswerNet:
Solution ID: 100001386
Product: SPSS Base
Version:
O/S: WINDOWS
Question Type: Graphics
Question Subtype: Creation
Title:
Blank bar for unselected category
Description:
Q.
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?
A.
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.
INPUT PROGRAM.
LOOP #I = 1 TO 100.
COMPUTE x = (TRUNC(UNIFORM(3)) + 1).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.
* Compute the weight variable.
COMPUTE weight = 1.
SAVE OUTFILE = 'TMP.SAV'.
* Create a new file to merge with the original data.
NEW FILE.
DATA LIST /x 1 weight 3-8.
BEGIN DATA
4 .00001
END DATA.
EXE.
* Merge the data.
ADD FILES /FILE=*
/FILE='TMP.SAV'.
EXECUTE.
* Weight the data.
WEIGHT
BY weight .
* Generate the chart, here done with the FREQUENCIES command.
FREQUENCIES VARIABLES=x /BARCHART FREQ.
Raynald Levesque rlevesque@videotron.ca
Visit My SPSS Pages: http://pages.infinit.net/rlevesqu/index.htm
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of
Satomi Wakita
Sent: Tuesday, November 27, 2001 3:29 PM
To: SPSSX-L@LISTSERV.UGA.EDU
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?
Thank you,
Satomi Wakita
Research Data Analyst
Center for Prevention Research and Development
Champaign, IL 61820