Conversion from GRAPH to GGRAPH

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Conversion from GRAPH to GGRAPH

Nick White
I need to convert the following graph to GPL

GRAPH
  /BAR(GROUPED)=PGT(2)(SchoolClimate0) PGT(2)(SchoolClimate1)
  PGT(2)(SchoolClimate2) BY Grade
  /MISSING=LISTWISE
  /TITLE= 'Students Answering NEVER to School Climate Questions'.

This example doesn't match any of the examples I found in the GPL Reference Guide. This graph produces bars for each of the 3 variables by grade where the height of a bar is determined by the percentage of cases with a response greater than 2 for that specific variable.

What I have so far:

GGRAPH
 /GRAPHDATASET NAME="GSHSdata" VARIABLES Grade, SchoolClimate0, SchoolClimate1, SchoolClimate2
 /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s = userSource(id("GSHSdata"))
DATA: grade=col(source(s), name("Grade"), unit.category())
DATA: schoolclimate0=col(source(s),name("SchoolClimate0"),unit.category())
DATA: schoolclimate1=col(source(s),name("SchoolClimate1"),unit.category())
DATA: schoolclimate2=col(source(s),name("SchoolClimate2"),unit.category())
GUIDE: axis(dim(2), label("Percent"))
GUIDE: axis(dim(1),label("Grade"))
GUIDE: texttitle("Students Answering NEVER to School Climate Questions")

At this point I am lost. Do I need a COORD: statement? How do I specify the ELEMENT: statement? What is the algebra for determining the percent of cases with a value greater than 2 for the schoolclimate variables? I gather I need to bin then count then percent - is there an example of this (I couldn't find it)? How do I end up with a two-dimensional clustered bar graph where each bar represents one of the variables within the cluster?

Let me know if you need more information.

Thanks,

Nick