LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 23 May 2006 11:03:36 -0400
Reply-To:     "Feinstein, Zachary" <ZFeinstein@HarrisInteractive.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Feinstein, Zachary" <ZFeinstein@HarrisInteractive.com>
Subject:      Re: Trying to Create Histogram in SPSS That Overlays Breaks in
              Variable - Is GPL The Way?
Comments: To: "Beadle, ViAnn" <viann@spss.com>
Content-Type: text/plain; charset="us-ascii"

Thank you ViAnn. The whole reason I brought up the issue of bar-charts was so that I could stack the vertical lines of the bins next to each other. For example, using the example you provided below, there would a bin for low ages and multiple bars for the (let's say) three regions there, then the next bin would have three vertical bars for the three regions, and so on. Currently, the code below makes separate histograms for each value of region. I want/need them combined to all be in one, if that' s possible. Two more questions to go with this. 1. How do we control the bin size? 2. Can I display a percentage instead of a COUNT. Thanks again. Zachary

________________________________

From: Beadle, ViAnn [mailto:viann@spss.com] Sent: Monday, May 22, 2006 9:30 PM To: Feinstein, Zachary; SPSSX-L@LISTSERV.UGA.EDU Subject: RE: Trying to Create Histogram in SPSS That Overlays Breaks in Variable - Is GPL The Way?

Do you want a bar chart of counts or a histogram in which interval level variables are "binned". The primary difference between the two is 1) the x axis has an interval scale in a histogram while a bar chart of counts usually doesn't; 2) a histogram tries to compute nice intervals for binning while a bar chart of counts provides a bar for every observed value of the x axis variable. You can get side by side histograms through GPL or through a basic GRAPH command. Let's start with your basic graph command: GRAPH /HISTOGRAM=age/ PANEL COLVAR=region COLOP=CROSS . The GPL is a bit more complicated: GGRAPH

/GRAPHDATASET NAME="graphdataset" VARIABLES=age region MISSING=LISTWISE

REPORTMISSING=NO

/GRAPHSPEC SOURCE=INLINE.

BEGIN GPL

SOURCE: s=userSource(id("graphdataset"))

DATA: age=col(source(s), name("age"))

DATA: region=col(source(s), name("region"), unit.category())

GUIDE: axis(dim(1), label("Age of Respondent"))

GUIDE: axis(dim(2), label("Frequency"))

GUIDE: axis(dim(3), label("Region of the U.S"))

ELEMENT: interval(position(summary.count(bin.rect(age*1*region))), shape.interior(

shape.square))

END GPL.

The break variable is crossed with the histgram variable. The "1" is required to stand in for the y-axis in the algebra

because summary.count only implicitly creates the second dimension. WARNING--this was tested with a new version

of GPL and might require some tweaking on your part.

________________________________

From: SPSSX(r) Discussion on behalf of Feinstein, Zachary Sent: Mon 5/22/2006 4:19 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Trying to Create Histogram in SPSS That Overlays Breaks in Variable - Is GPL The Way?

I have had very good luck utilizing the listserv for figuring how to do some nifty scatterplots. Thanks to all who have replied. Now I need to build a histogram for a single variable but I would like multiple histograms for each of my breaks overlaid on top of each other.

The code below builds a histogram but it does not group the categories of the x-axis. I would need to figure how to do that. Then, assuming I have a three-category variable called break1, how would I do three histograms in one so that they show up side-by-side? Is this even doable or would I have to create a bar-chart of sorts? Perhaps break the variables in the datafile then do a simple bar chart? Would greatly prefer a histogram solution if one exists.

Thanks.

Zachary zfeinstein@harrisinteractive.com GGRAPH

/GRAPHDATASET NAME = "hist1" VARIABLES = loy_var5 COUNT()

/GRAPHSPEC SOURCE = INLINE.

BEGIN GPL

SOURCE: s = userSource(id("hist1"))

DATA: loy_var5 = col(source(s), name("loy_var5"), unit.category())

DATA: count = col(source(s), name("COUNT"))

GUIDE: axis(dim(1), label("Loyalty Level"))

GUIDE: axis(dim(2), label("Count"))

ELEMENT: interval(position(loy_var5 * count))

END GPL.


Back to: Top of message | Previous page | Main SPSSX-L page