|
PQL Procedures | Overview |
A VisualPQL main routine can be followed by one or more procedures. The main routine specifies the data the procedures use by putting it into a procedure table using the PERFORM PROCS
command. This copies local variables from the main routine into the procedure table. The procedures either operate on the procedure record immediately it is put into the procedure table or, if the table has to be sorted, the procedures operate after all the data has been put in the table and sorted.
The procedure specifications describe how the data in the procedure table is treated. Other than Full Report, the procedures are specified as a single VisualPQL command with numerous options. There are some common options that are the same for all procedures.
The general structure of a program that uses procedures is:
RETRIEVAL | PROGRAM . . VisualPQL code that creates variables for the procedure . PERFORM PROCS . PQL_PROCEDURE command and options. PQL_PROCEDURE command and options. END RETRIEVAL | PROGRAMFollowing is a listing and brief description of the VisualPQL Procedures available.
BMDP SAVE FILE
|
Generates a file that can be directly accessed by the
BMDP ® statistical package.
|
CONDESCRIPTIVE
| Produces descriptive statistics for specified variables. The statistics available include sum, mean, minimum, maximum, standard deviation, skewness, kurtosis, variance, standard error of the mean, coefficient of variability and confidence interval. |
CSV SAVE FILE
| Generates a file that can be accessed by any package that reads Comma Separated Variable format. |
DBASE SAVE FILE
|
Generates a file that can be directly accessed by DBASE
®.
|
DESCRIPTIVE
|
Produces descriptive statistics and a frequency bar chart for a specified variable. The statistics include sum, mean, minimum, maximum, standard deviation, skewness, kurtosis, variance, standard error of the mean, coefficient of variability and confidence interval. This essentially replaces both CONDESCRIPTIVE and FREQUENCIES . The frequency chart is produced by the SIRGRAPH module. Output can be in HTML format suitable for viewing through a browser. |
DIF SAVE FILE
| Generates a file in the Data Interchange Format accepted by many PC packages. |
FREQUENCIES
| Produces descriptive statistics of variables with counts and percentage distributions for values of the variables. Seventeen statistics are available. |
GRAPH
|
Produces file suitable for input to the SIRGRAPH module (only available on Windows). The file is a text file that can be transferred to a Windows based computer if necessary. A wide variety of 2D and 3D graphs can be produced. |
MINITAB SAVE FILE
|
Generates a file that can be directly accessed by the
MINITAB ® statistical package.
|
PLOT
|
Produces a file for graphical display of line or scatter plots. Linear regression statistics
are also produced. The graphic output is produced by the SIRGRAPH module.
|
REPORT - Quick
| Produces columnar reports with a minimum of specification using keywords to specify formats, sorting, break-points, totals and subtotals. |
REPORT - Full
| Extends the VisualPQL programming language to handle complex reports with changing report formats, conditional branching, nesting and computations. |
SAS SAVE FILE
|
Generates files that can be directly accessed by the
SAS ® statistical package. The schema information and data are output in
SAS text export format.
|
SAVE TABLE
| Creates tables on SIR/XS tabfiles. |
SIR SAVE FILE
| Creates a sequential copy of a SIR/XS database. |
SPREAD SHEET
| Displays data in a spreadsheet style format. |
SPSS SAVE FILE
|
Generates a file that can be accessed by the
SPSS ® statistical package.
|
SYSTAT SAVE FILE
|
Generates a file that can be accessed by the SYSTAT ®
statistical package.
|
TABULATE
| Produces cross tabulations with options for nesting categories and concatenating tables. Cells can contain various statistics in addition to counts, percentages and quantiles. Output can be in HTML format suitable for viewing through a browser. |
WRITE RECORDS
|
Generates a fixed format text data file that may be in any sequence.
|
XML SAVE FILE
| Generates a file in XML (eXtensible Markup Language), that can be accessed by many other packages and applications. |
Except for the Full Report procedure, the actions of the procedure are completely specified by the keywords and options on the procedure command. Full Report is a programming language and subsequent VisualPQL commands specify the processing performed.
As many procedures as necessary may be specified in a single program. Options specified on one procedure have no effect on subsequent procedures.
The end product of any procedure is a file. Specify a filename on the command. Frequencies, Condescriptive and Tabulate can append the output of one procedure to the end of the previous procedure's output. If there are multiple procedures of the same type, specify the output file on the first such procedure. If subsequent procedures of the same type have no output file specification, the output is appended to the end of the previously specified file.
All procedures can produce sorted output.
FILENAME
|
Specify the filename to be created by the procedure. Enclose filenames that are not in the same format as standard SIR/XS names in quotes. Specify either STDOUT or CONSOL (Not in quotes) to display the result of a procedure in normal place that output is being written to. In the case of a normal interactive session this is the scrolled output buffer. FILENAME is a required clause except where noted.
|
VARIABLES
|
Specifies the procedure variables that are used by the procedure. For procedures that allow multiple variables, the order in which variables are specified is the order they appear in the output file. If VARIABLES is not specified, the default variables are output. (See INCLUDE and EXCLUDE .)
A variable list contains variable names or three keywords: VARIABLES = S(1) AS SALARY or VARIABLES = S(1) 'Salary‘ TO Specifies a list of selected variables A to B. The variables included in the list depend on the sequence in which variables are defined and include all variables defined between the two specified variables as well as the specified variables themselves. If summary variables are created with a GET VARS ALL rowm a record type, then the sequence is the same as the record.
The whole list can be enclosed in brackets (recommended) and thus the list starts and stops with brackets (). If the list is not in brackets then one of the following signifies the end of the list: Some procedures allow certain non-standard specifications in their variable lists and these are noted in the documentation for those procedures.
|
SORT
|
Specifies the sequence of the output.
n is an integer that specifies the maximum number of records to be sorted. The default for this parameter is either the number of records in the database or the value specified in the sortn parameter and need only be specified if the number of records in the procedure table is greater than the default. The procedure table is sorted by the specified variables in variable list order. A variable name followed by (A) or (D) specifies that for that variable the sort is in Ascending order (the default) or in Descending order. A sort is implicit when a BREAK clause is specified in Quick Report. |
BOOLEAN
| Selects procedure table records used by the procedure. The procedure table records that match the logical expression are selected. If this option is not specified, all procedure table records are used. |
SAMPLE
|
Selects a random sample of the procedure table records for use 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). e.g. Specify .25 to use a 25% sample. If you wish to alter the default seed used to initialise the random number generator, use the SEED option on the retrieval command.
|
PERFORM PROCS
command is executed.
INTEGER, REAL, STRING, DATE
and TIME
.
In addition, local variables are implicitly declared when a value is
assigned to an undeclared variable through commands such as COMPUTE,
SET
and GET VARS
.
See variables for further details.
Each variable and array has a schema entry that includes information about data type, valid values, missing values, variable labels and value labels.
The GET VARS
command copies schema information from the database or table into the schema for that local variable. The schema for other variables is created from the variable declaration and definition commands in the program. The VisualPQL Procedures use these schema entries as they format their output.
A routine may access database or table data and may reference an external block of variables.
DEFINE PROCEDURE VARIABLES
command specifies particular variables to use to build the
procedure table. Using this command can result in performance improvements if the
program has a large number of
local variables that are not required by the procedures.
This command is also used to include data from arrays or from
EXTERNAL VARIABLE
BLOCK
s in the procedure table.
BOOLEAN
option specifies selects records from the procedure
table to include in the procedure. This feature is useful when specifying
multiple procedures in a single VisualPQL program where each procedure is to work with
a subset of the procedure table records.
VARIABLES
keyword on the procedure command.
The INCLUDE
and EXCLUDE
commands alter the
default variables used by a procedure; they do not alter the content of the
procedure table, merely the default list of variables. These commands are placed
in the main routine anywhere before the first procedure command. INCLUDE
and EXCLUDE
are mutually exclusive; specify either
one or the other, not both.
If the DEFINE PROCEDURE VARIABLES
command has excluded a
particular variable from the procedure table, do not specify that variable on an
INCLUDE
or EXCLUDE
as this has no effect.
INCLUDE variable, .....Specifies the default variables referenced by all procedures. The order of the variables determines the sequence used on the output file.
EXCLUDE variable, ...Excludes variables from the default variable list.
DEFINE PROCEDURE
VARIABLES
command to include only the
variables that are needed.
RETRIEVAL
and PROGRAM
commands.
The NOPROCS
option on these commands saves the executable version of the program without the procedure
specifications. This executable can be run and procedure commands appended to
it. The general structure for this is:Create the executable:
RETRIEVAL | PROGRAM SAVE=member_name NOPROCS NOEXECUTE PQL_COMMAND ... PERFORM PROCS ... ... PQL_PROC_COMMAND END RETRIEVAL | PROGRAMRun the executable:
RETRIEVAL | PROGRAM GET = member_name PQL_PROC_COMMAND . . . PQL_PROC_COMMAND . . . END RETRIEVAL | PROGRAM
SAVE TABLE
to save the Procedure Table as a SIR/XS Tabfile table if
necessary. Run any subsequent procedures against this subset of data rather than
the full database. For exampleCreate the table:
RETRIEVAL | PROGRAM SAVE=member_name NOPROCS NOEXECUTE PQL_COMMAND ... PERFORM PROCS ... ... SAVE TABLE MYTABFILE.MYTABLE END RETRIEVAL | PROGRAMUse the table:
PROGRAM . PROCESS ROWS MYTABFILE.MYTABLE . GET VARS ALL . PERFORM PROCS . END ROW PQL_PROC_COMMAND option END PROGRAM