HomeStartingEnvironmentDBMSVisualPQLProceduresSQLFormsHost/APIIndex
PQL Procedures homecontents start chapter top of pagebottom of pagenext page index SAS Save File

SAS Save File

SAS® software is a data analysis and reporting tool published by SAS Institute, Inc. of Cary, North Carolina.

The SAS SAVE FILE procedure generates files in "exportable" (text) format.

These files include procedure table data and schema information from the PQL program, including value labels, variable labels and missing value indicators.

SAS SAVE FILE EXPORT   = filename1 , filename2
    [ BOOLEAN   = (logical_expression ) ]
    [ FORMAT = 'formatprefix']
    [ LRECL = n]
    [ NOLABELS ]
    [ SAMPLE    = fraction ]
    [ SORT      = [ (n) ]  variables [(A)|(D)], ...]
    [ VARIABLES = varlist | ALL]
EXPORT Creates two text files. The first is the SAS control statement file. It contains a SAS DATA step including all appropriate SAS commands such as MISSING, INFILE, INPUT and LABEL and a PROC FORMAT step containing the value labels. If the NOLABELS clause is specified, the PROC FORMAT step is not generated.
The second file is a fixed format data file, containing the data from the procedure table. This file is referenced in the DATA step of the first file.

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.

FORMAT The names assigned to the value label formats in the PROC FORMAT are generated names in the format TnX where 'T' and 'X' are the letters used and n is a sequence number from 1 upwards for each variable requiring a format. Format names for character variables begin with a $ sign. If the SAS analyst combines multiple datasets, the same generated name would be used on each dataset and this would cause conflicts. Specify a different format prefix for each SIR/XS procedure to ensure unique generated format names. The specified prefix is used instead of the default 'T'. The final generated name must not exceed 32 characters.

LRECL An LRECL parameter is generated on the SAS INFILE command. Use the LRECL parameter to set this value. It must be greater than 50.

NOLABELS Specifies that variable and value labels are not written to the SAS file. This can save significant processing time if many labels are involved.

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.

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.

VARIABLES Specifies the procedure variables that are written to the output file. The order in which they are specified is the order in which they appear in the output file. This corresponds to the order in which they are declared in the SAS DATA step. If this option is not specified, the default variables are output.

A summary report is produced that lists the variables in the files, the name of the files and other information.

Example 1: SAS

The following produces a SAS file. The files created by this run are text and can be edited. The program creates a procedure table record for each employee and contains the computed time spent in the current position (TCURRENT) and the variables ID, GENDER, MARSTAT and CURRPOS from the database.

RETRIEVAL
INTEGER TCURRENT
PROCESS CASES ALL
.  PROCESS REC 1
.    GET VARS ID GENDER MARSTAT CURRPOS
.    PROCESS REC 2 VIA (CURRPOS)
.         COMPUTE TCURRENT = TODAY(0) - STARTDAT
.    END PROCESS REC
.    PERFORM PROCS
.  END PROCESS REC
END PROCESS CASE
SAS SAVE FILE EXPORT = SASPROC.TXT , SASDATA.DAT
END RETRIEVAL

homecontents start chapter top of pagebottom of pagenext page index