I'm trying something new--charts in SPSS (instead of exporting output to
Excel). Some questions about bar charts and categorical data: 1) I want to do clustered bar charts, based on percentages in each cell, not counts. The crosstab barchart subcommand only allows charts based on counts. I couldn't find anything in chart builder, interactive chart, bar chart, etc. that would allow me to do this. Any way to do this in SPSS or do I have to export to Excel? 2) In chartbuilder/GPL, is there any way to assign data value labels? 3) In chartbuilder/GPL, I temporarily change categorical variable to scale, then assign mean to the variable to get percent. Then in chart editor I add the data value label. It gives me value out 4 decimal points. Is there a way to a) just get to two decimal points? b) change the the number to a percentage? and c) increase font size of the data value label? Thanks. |
1. to obtain percents,
a) go to Graphs>Bar and choose any one of the bar types with summaries of groups of cases. At the top of the dialog, choose % of cases. b) If you're doing it in Chart Builder, choose the percentage function for the y axis from the list of statistics within the Element Properties dialog. c) If you're using interactive Graphs, choose the percentage special variable in the left list and assign it to the y axis in the dialog box. 2. A label UI is not provided in the Chart Builder so you'll have to edit the syntax to assign data value labels using GPL. Use the label function on the element statement and if you're doing the aggregation within SPSS name the variable holding the value as the parameter. If you're doing your own aggregation within the element statement, also use that within the label command. Here's a real simple example: * Chart Builder. GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat COUNT()[name= "COUNT"] MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"), unit.category()) DATA: COUNT=col(source(s), name("COUNT")) GUIDE: axis(dim(1), label("Employment Category")) GUIDE: axis(dim(2), label("Percent")) SCALE: cat(dim(1), include("1", "2", "3")) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.percent(jobcat*COUNT, base.all( acrossPanels()))), shape.interior(shape.square), label(summary.percent(COUNT))) END GPL. 3. You shouldn't have to assign any variable and set the statistic to mean to get a simple percent of counts. If you run my example, the default is two decimal points. To increase the font size, you will have to take the chart into the data editor since GPL does no styling. Select the label and change the text for the label. You can save the template and then apply it to future charts but choose only the text styling for data labels in the chart template dialog. You can then set the template to be used in chart builder. ________________________________ From: SPSSX(r) Discussion on behalf of C Kirkman Sent: Wed 8/2/2006 12:57 PM To: [hidden email] Subject: bar charts I'm trying something new--charts in SPSS (instead of exporting output to Excel). Some questions about bar charts and categorical data: 1) I want to do clustered bar charts, based on percentages in each cell, not counts. The crosstab barchart subcommand only allows charts based on counts. I couldn't find anything in chart builder, interactive chart, bar chart, etc. that would allow me to do this. Any way to do this in SPSS or do I have to export to Excel? 2) In chartbuilder/GPL, is there any way to assign data value labels? 3) In chartbuilder/GPL, I temporarily change categorical variable to scale, then assign mean to the variable to get percent. Then in chart editor I add the data value label. It gives me value out 4 decimal points. Is there a way to a) just get to two decimal points? b) change the the number to a percentage? and c) increase font size of the data value label? Thanks. |
In reply to this post by C Kirkman
Thanks for the suggestions.
1) Graphs>bar will only let me put in a variable if I select the "other statistic" button. All the other options are grayed out. (yest another bug in 14.0?) 2) I tried to follow your suggestion for Chart Builder. It's not giving me any option except for count for categorical variables. 3) I got it to work in IGRAPH, but that doesn't allow me to do someof the other things I need to with these charts. 4) I'll look at the GPL when I've got a little more time. Now, I'm really jammed up against a deadline. |
Free forum by Nabble | Edit this page |