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
SOURCE: s = userSource(id("Employeedata"))
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))
Figure 2. Creating categories with the eval function
Creating categories with the eval function