|
When preparing [in V17.0.1] a scale / categorical bar chart
I want to sort on the average value of the scale variable not the value/label,
etc of what is in the value label information of the categorical variable. i.e.
from highest to lowest average. Is this possible ? Mark
Webb +27
21 786 4379 +27
72 199 1000 Skype
- webbmark |
|
Yes, provided that you use the GGRAPH command to produce your
chart. Here’s an example with the employee data.sav file: GGRAPH /GRAPHDATASET NAME="graphdataset" VARIABLES=jobcat
salary MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"),
unit.category()) DATA: salary=col(source(s), name("salary")) GUIDE: axis(dim(1), label("Employment Category")) GUIDE: axis(dim(2), label("Mean Current Salary")) SCALE: cat(dim(1), include("1", "2",
"3"), sort.statistic(summary.mean(salary))) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.mean(jobcat*salary)),
shape.interior(shape.square)) END GPL. Note that aggregation is done within the GPL rather than via the
GGRAPH command. The sort.statistic function on the SCALE statement for the X axis
does the trick. The sort.statistic function requires one of the statistics
functions within GPL itself. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Mark Webb When preparing [in V17.0.1] a scale / categorical bar chart
I want to sort on the average value of the scale variable not the value/label,
etc of what is in the value label information of the categorical variable. i.e.
from highest to lowest average. Is this possible ? Mark
Webb +27
21 786 4379 +27
72 199 1000 Skype
- webbmark |
|
Hi ViAnn Is there a sort function
to sort the same graph descending? Christian Von: SPSSX(r)
Discussion [mailto:[hidden email]] Im
Auftrag von ViAnn Beadle Yes, provided that
you use the GGRAPH command to produce your chart. Here’s an example with
the employee data.sav file: GGRAPH /GRAPHDATASET
NAME="graphdataset" VARIABLES=jobcat salary MISSING=LISTWISE
REPORTMISSING=NO /GRAPHSPEC
SOURCE=INLINE. BEGIN GPL SOURCE:
s=userSource(id("graphdataset")) DATA:
jobcat=col(source(s), name("jobcat"), unit.category()) DATA:
salary=col(source(s), name("salary")) GUIDE:
axis(dim(1), label("Employment Category")) GUIDE:
axis(dim(2), label("Mean Current Salary")) SCALE:
cat(dim(1), include("1", "2", "3"),
sort.statistic(summary.mean(salary))) SCALE:
linear(dim(2), include(0)) ELEMENT:
interval(position(summary.mean(jobcat*salary)), shape.interior(shape.square)) END GPL. Note that aggregation
is done within the GPL rather than via the GGRAPH command. The sort.statistic
function on the SCALE statement for the X axis does the trick. The
sort.statistic function requires one of the statistics functions within GPL
itself. From:
SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mark Webb When preparing [in V17.0.1] a scale / categorical bar chart I want to
sort on the average value of the scale variable not the value/label, etc of
what is in the value label information of the categorical variable. i.e. from
highest to lowest average. Is this possible ? Mark Webb +27 21 786 4379 +27 72 199 1000 Skype - webbmark |
|
The reverse function will do this. There are examples in Help. From: la volta statistics
[mailto:[hidden email]] Hi ViAnn Is there a sort function to sort the same graph descending? Christian Von: SPSSX(r)
Discussion [mailto:[hidden email]] Im Auftrag von ViAnn Beadle Yes, provided that you use the GGRAPH command to produce your
chart. Here’s an example with the employee data.sav file: GGRAPH /GRAPHDATASET NAME="graphdataset"
VARIABLES=jobcat salary MISSING=LISTWISE REPORTMISSING=NO /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource(id("graphdataset")) DATA: jobcat=col(source(s), name("jobcat"),
unit.category()) DATA: salary=col(source(s), name("salary")) GUIDE: axis(dim(1), label("Employment
Category")) GUIDE: axis(dim(2), label("Mean Current
Salary")) SCALE: cat(dim(1), include("1", "2",
"3"), sort.statistic(summary.mean(salary))) SCALE: linear(dim(2), include(0)) ELEMENT: interval(position(summary.mean(jobcat*salary)),
shape.interior(shape.square)) END GPL. Note that aggregation is done within the GPL rather than via the
GGRAPH command. The sort.statistic function on the SCALE statement for the X
axis does the trick. The sort.statistic function requires one of the statistics
functions within GPL itself. From: SPSSX(r) Discussion
[mailto:[hidden email]] On Behalf Of Mark Webb When preparing [in V17.0.1] a scale / categorical bar chart
I want to sort on the average value of the scale variable not the value/label,
etc of what is in the value label information of the categorical variable. i.e.
from highest to lowest average. Is this possible ? Mark
Webb +27
21 786 4379 +27
72 199 1000 Skype
- webbmark |
| Free forum by Nabble | Edit this page |
