HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
PQL Procedures homecontents start chapter top of pagebottom of pagenext page index Graph

GRAPH SAVE FILE

GRAPH SAVE FILE OBS = [ var| function(var)]  [ , ... ]
                ROW = var [ 'row title' ]
                          [ (i1 [,i2 [,i3 ]]) ]
                          [ 'value labels' 'xxxx' ... ]
              [ BOOLEAN = (log_expression) ]
              [ COL = var [ 'col title' ]
                          [ (i1 [,i2 [,i3 ]]) ]
                          [ 'value labels' 'xxxx' ... ] ]
              [ FILENAME = filename]
              [ MULTIPLE ]
              [ SAMPLE = sample ]
              [ SUBTITLE = 'subtitle' ]
              [ TITLE = 'title' ]
The GRAPH SAVE FILE procedure produces a text file suitable for input to the SIRGRAPH module. The procedure can run on any supported hardware platform but SIRGRAPH itself is Windows based.

The resulting graph can be two-dimensional, stacked two dimensional or three dimensional.
A two dimensional graph has an observation variable to control the magnitude of each graphed item and a row control variable with discrete values that determines the number of categories graphed.
A stacked two dimensional graph has multiple values in each category. These may be separate observation variables or may represent the different values from a second control variable.
A three dimensional graph has a row and a column control variable that determine the number of categories and an observation variable that controls the magnitude of each category.

OBS This is required. Specifies the variable that is used to calculate totals, averages or other values that then translates into the magnitude on the graph e.g. the height of individual bars in the chart.

The default magnitude for numeric observation variables is the total or SUM. The default for string observation variables is COUNT that adds 1 to the magnitude for each non-missing value. Specify either the name of a variable or the name of a function with the name of the variable in parentheses. e.g. OBS=SALARY or OBS=COUNT(SALARY). The functions are:

  • AVG - Average value (AVERAGE & MEAN are synonyms)
  • CNT - Count of non-missing values (COUNT is a synonym)
  • MAX - Maximum Value (MAXIMUM is a synonym)
  • MIN - Minimum Value (MINIMUM is a synonym)
  • PCCOUNT - Percentage of the column using counts
  • PCSUM - Percentage of the column using totals
  • PRCOUNT - Percentage of the row using counts
  • PRSUM - Percentage of the row using totals
  • PTCOUNT - Percentage of the total using counts
  • PTSUM - Percentage of the total using totals
  • SUM - Sum of values (TOTAL is a synonym)

Multiple observation variables can be specified that generate a stacked 2D graph (cannot specify a COL clause with multiple observation variables).

ROW This is required. Specifies a row control variable. The values of this variable determine the number of rows on the graph. The variable can either have discrete values specified as part of the variable definition or you can specify the values in this clause. The variable may be numeric or a short string (up to eight characters).

The default row title is the variable label or variable name if there is no label. Specify a row title in quotes immediately after the variable name if required.

If the variable does not have defined specific values or you want to specify different categories, specify the values in parentheses.
One number, (n), specifies the number of cells that have the first n values from the variable (cannot be used for floating point variables).
Two numbers, (min,max), specify the integer values between min and max are the number of cells (can only be used for integers).
Three numbers, (min,max,interval), specify values between min and max in interval sizes e.g. (1000,6000,500) produces 10 rows. This must be specified for floating point control variables and cannot be used for strings.

The individual row values have labels. By default these are taken from the value labels or categorical string values. Specify value labels on the command to label specified category values or to use instead of the defaults. Enclose each label in quotes.

BOOLEAN Specifies which procedure table records are used by the procedure. The procedure table records for which the logical expression is true are used by the procedure. If this option is not specified, all procedure table records are used.

COL Specifies a column control variable. If specified, must not precede the ROW parameter. Cannot be used with multiple observation variables.

The values of this variable determine the number of columns on the graph unless the MULTIPLE option is specified (see below). The variable can either have discrete values specified as part of the variable definition or you can specify the values in this clause. The variable may be numeric or a short string (up to eight characters).

The default column title is the variable label or variable name if there is no label. Specify a column title in quotes immediately after the variable name if required.

If the variable does not have defined specific values or you want to specify different categories, specify the values in parentheses.
One number, (n), specifies the number of cells that have the first n values from the variable (cannot be used for floating point variables).
Two numbers, (min,max), specify the integer values between min and max are the number of cells (can only be used for integers).
Three numbers, (min,max,interval), specify values between min and max in interval sizes e.g. (1000,6000,500) produces 10 rows. This must be specified for floating point control variables and cannot be used for strings.

The individual column values have labels. By default these are taken from the value labels or categorical string values. Specify value labels on the command to label specified category values or to use instead of the defaults. Enclose each label in quotes.

FILENAME Specify the filename created by the procedure.
If no FILENAME clause is specified, the output is written to a default file sirgraph.srg.

MULTIPLE The keyword MULTIPLE specifies that a stacked 2D graph using the column variable is produced rather than a 3D graph.

SAMPLE Specifies that a random sample of the procedure table records are used by the procedure.
The fraction specifies the percent of records used and is specified as a positive decimal number less than or equal to 1 (one). .25, for example specifies that a 25% sample be used.

SUBTITLE Specifies the heading text on the graph footer. Enclose the text in quotes. If SUBTITLE is not used, the subtitle is "Created by SIR/XS on DATE at TIME".

TITLE Specifies the text on the graph title. Enclose the text in quotes. If TITLE is not used, the title is the variable label or name when no label.

See
examples.

homecontents start chapter top of pagebottom of pagenext page index

Graph Examples

Example 1

Produces an analysis of the number of employees by Education Level (EDUC).

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS EDUC
.    PERFORM PROCS
.  END REC
END CASE
GRAPH SAVE FILE   OBS  = COUNT(EDUC) /
                  ROW  = EDUC        /
            FILENAME   = GRAPH1.SRG  /
            TITLE      = 'Education Levels in Company'
END RETRIEVAL
On completion of the program, the file GRAPH1.SRG contains text that can be viewed with
ESCAPE 'sirgraph.exe GRAPH1.srg'
which looks something like:

Example 2

Produces an analysis of salary by current position (CURRPOS).

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS SALARY CURRPOS
.    PERFORM PROCS
.  END REC
END CASE
GRAPH SAVE FILE   OBS  = SALARY /
                  ROW  = CURRPOS        /
            FILENAME   = GRAPH2.SRG  /
            TITLE      = 'Total salary by position in Company'
END RETRIEVAL
On completion of the program, the file GRAPH2.SRG contains text that can be viewed with
ESCAPE 'sirgraph.exe GRAPH2.srg'
which looks something like:

Example 3

Produces an analysis of percentage of salary by gender.

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS SALARY GENDER
.    PERFORM PROCS
.  END REC
END CASE
GRAPH SAVE FILE   OBS  = PTSUM(SALARY) /
                  ROW  = GENDER        /
            FILENAME   = GRAPH3.SRG  /
            TITLE      = 'Salary percentage by Gender'
END RETRIEVAL
On completion of the program, the file GRAPH2.SRG contains text which can be viewed with
ESCAPE 'sirgraph.exe GRAPH3.srg'
You might then use some of the options in sirgraph to produce a chart something like:

Example 4

Produces an analysis of percentage of salary by gender by education.

RETRIEVAL
PROCESS CASES
.  PROCESS REC EMPLOYEE
.    GET VARS SALARY GENDER EDUC
.    PERFORM PROCS
.  END REC
END CASE
GRAPH SAVE FILE   OBS  = PRSUM(SALARY) /
                  ROW  = GENDER        /
                  COL  = EDUC        /
            FILENAME   = GRAPH4.SRG  /
            TITLE      = 'Salary percentage by Gender & Education'
END RETRIEVAL
On completion of the program, the file GRAPH2.SRG contains text which can be viewed with
ESCAPE 'sirgraph.exe GRAPH4.srg'
You might then use some of the options in sirgraph to produce a chart something like:

homecontents start chapter top of pagebottom of pagenext page index