Grouping by Separate Variables (GPL)

This example demonstrates how you can create groups based on separate variables, so that each instance of the graphic element shows the different variable information. In this example, you are comparing the results of two variables across a categorical variable.

Figure 1. GPL for grouping by separate variables
* Open sample file Employee Data.sav.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary educ
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: salbegin=col(source(s), name("salbegin"))
  DATA: salary=col(source(s), name("salary"))
  DATA: educ=col(source(s), name("educ"), unit.category())
  GUIDE: axis(dim(1), label("Educational Level (years)"))
  ELEMENT: line(position(summary.mean(educ*salary)),color("Current Salary"))
  ELEMENT: line(position(summary.mean(educ*salbegin)),color("Beginning Salary"))
END GPL.
Figure 2. Grouping by separate variables
Grouping by separate variables