Functions (XGRAPH command)

Functions must be enclosed in square brackets.

Value function:

The VALUE function yields the value of the specified y-axis variable for each case. It always produces one data element for each case.

Aggregation functions:

Two groups of aggregation functions are available: count functions and summary functions.

Count functions:

COUNT. Frequency of cases in each category.

PCT. Frequency of cases in each category expressed as a percentage of the whole.

CUPCT. Cumulative percentage sorted by category value.

CUFREQ. Cumulative frequency sorted by category value.

  • Count functions yield the count or percentage of valid cases within categories determined by the xvars and the zvars, as in:

    XGRAPH ([PCT] [BAR]) BY jobcat [c] BY gender [c].

  • Count functions do not operate on a variable.
  • Count functions do not have any arguments.

Summary functions:

MINIMUM. Minimum value of the variable.

MAXIMUM. Maximum value of the variable.

VALIDN. Number of cases for which the variable has a nonmissing value.

SUM. Sum of the values of the variable.

CUSUM. Sum of the summary variable accumulated across values of the category variable.

MEAN. Mean.

STDDEV. Standard deviation.

VARIANCE. Variance.

MEDIAN. Median.

GMEDIAN. Group median.

MODE. Mode.

PTILE(x). Xth percentile value of the variable. X must be greater than 0 and less than 100.

PLT(x). Percentage of cases for which the value of the variable is less than x.

PGT(x). Percentage of cases for which the value of the variable is greater than x.

NLT(x). Number of cases for which the value of the variable is less than x.

NGT(x). Number of cases for which the value of the variable is greater than x.

PIN(x1,x2) . Percentage of cases for which the value of the variable is greater than or equal to x1 and less than or equal to x2. x1 cannot exceed x2.

NIN(x1,x2) . Number of cases for which the value of the variable is greater than or equal to x1 and less than or equal to x2. x1 cannot exceed x2.

  • Summary functions operate on summary variables (variables that record continuous values, like age or expenses). To use a summary function, specify the name of one or more variables before the name of the function and the data element type, both of which are in square brackets, as in:

    XGRAPH (salary [SUM] [BAR]) BY jobcat[c] BY gender[c].

  • You can specify a list of variables on which the function operates, as in:

    XGRAPH ((salary + salbegin) [SUM] [BAR]) BY jobcat[c] BY gender[c].

    This syntax is equivalent to:

    XGRAPH (salary [SUM] [BAR] + salbegin [SUM] [BAR]) BY jobcat[c] BY gender[c].