Sorting charts on the average value of scale variable

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sorting charts on the average value of scale variable

Mark Webb-3

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

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

Re: Sorting charts on the average value of scale variable

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
Sent: Monday, March 02, 2009 9:18 AM
To: [hidden email]
Subject: Sorting charts on the average value of scale variable

 

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

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

AW: Sorting charts on the average value of scale variable

la volta statistics

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
Gesendet: Montag, 2. März 2009 17:31
An: [hidden email]
Betreff: Re: Sorting charts on the average value of scale variable

 

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
Sent: Monday, March 02, 2009 9:18 AM
To: [hidden email]
Subject: Sorting charts on the average value of scale variable

 

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

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

Re: Sorting charts on the average value of scale variable

ViAnn Beadle

The reverse function will do this. There are examples in Help.

 

From: la volta statistics [mailto:[hidden email]]
Sent: Monday, March 02, 2009 10:11 AM
To: 'ViAnn Beadle'; [hidden email]
Subject: AW: Sorting charts on the average value of scale variable

 

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
Gesendet: Montag, 2. März 2009 17:31
An: [hidden email]
Betreff: Re: Sorting charts on the average value of scale variable

 

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
Sent: Monday, March 02, 2009 9:18 AM
To: [hidden email]
Subject: Sorting charts on the average value of scale variable

 

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

[hidden email]