Search
Ploticus >
Scripts >
Variables
More advanced ploticus scripts can set and reference variables.
Variable names must begin with a letter and may contain letters, digits, underscore (_) and period (.).
Names are case-sensitive. Maximum length of a variable name is 38 characters.
Variables may hold numbers, alphanumerics, or
lists,
but are always internally stored in alphanumeric form, with a maximum content length is 250 characters.
All variables are global in scope.
Variables may be assigned using the #set directive, like this:
#set ymax = 200
Variables may be referenced (used) anywhere in a script.
An at-sign (@) is used at the beginning of a variable name when its contents
are to be displayed or referenced, for example:
yrange: 0 @ymax
In some situations (select statements and getdata filters) you may need to use
two at-signs (@@), so that one at-sign survives the script evaluation (if that's what you want).
An attempt to evaluate a variable that has never been assigned a value
will result in cancellation of the evaluation (the variable name will be
passed through transparently) and no error condition will be raised.
Several
reserved variables
exist.
System Variables
Ploticus sets certain variables, described below.
These variables may be accessed by user scripts as needed.
In order to reference a variable immediately after the proc that set the variable,
#endproc
must be used to mark the end of the proc that set the variable.
Nothing bad will happen if you happen to assign a value to one of these
variables, other than the chance that ploticus will update the variable's value
when you're not expecting it.
PLVERSION
The ploticus version number.
AREALEFT AREARIGHT AREABOTTOM AREATOP
Set by proc areadef to the locations of the current plot area edges in
absolute units.
XMIN XMAX YMIN YMAX
Set by proc areadef to the limits in scaled units, of the plotting area.
XINC YINC
Set by proc axis to the scale increment in X or Y.
DATAXMIN, DATAXMAX
The minima and maxima of the data field when xautorange is used.
Different from XMIN and XMAX in that these do not include any margin.
DATAYMIN, DATAYMAX
The minima and maxima of the data field when yautorange is used.
Different from YMIN and YMAX in that these do not include any margin.
CM_UNITS
if user has opted to use centimeters as absolute units, this will contain 1,
otherwise 0.
DEVICE
the output display format, one of:
png gif eps ps bwps x11 jpeg svg svgz swf
NFIELDS
the number of fields per record in the current data set.
NRECORDS
the number of records in the current data set.
NVALUES
the number of in-range plottable points rendered by the most recent
proc scatterplot or proc rangebar.
May be used in the proc scatterplot legend label.
RANGEBARMEDIAN RANGEBARMIN RANGEBARMAX
the median, min, and max value of the most recently drawn rangebar,
in scaled units.
TOTALS
Set by proc processdata when action is totals, it holds
either a single total value, or a comma-delimited list of total values.
BREAKFIELD1 ..
Set by proc processdata when action is breaks, it holds
the contents of the break field(s), before reaching the breakpoint.
XSTART, YSTART
X and Y location where the most recent proc lineplot curve began, in scaled units.
XFINAL, YFINAL
X and Y location where the most recent proc lineplot curve ended, in scaled units.