Creating Categories Using the eval Function (GPL)

This example demonstrates how you can use the eval function to create categories based on an expression.

Figure 1. GPL for creating categories with the eval function
* Open sample file Employee Data.sav.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=salbegin salary educ
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  DATA: salbegin = col(source(s), name("salbegin"))
  DATA: salary = col(source(s), name("salary"))
  DATA: educ = col(source(s), name("educ"))
  TRANS: college = eval(educ>12 ? "College" : "No College")
  GUIDE: axis(dim(2), label("Current Salary"))
  GUIDE: axis(dim(1), label("Beginning Salary"))
  ELEMENT: point(position(salbegin*salary), color(college))
END GPL.
Figure 2. Creating categories with the eval function
Creating categories with the eval function