|
PQL Procedures | SAS Save File |
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. The second file contains data.
SAS SAVE FILE EXPORT = filename1 , filename2
[ BLANKUND ]
[ BOOLEAN = (logical_expression ) ]
[ FILENAME = sasname ]
[ FORMAT = 'formatprefix' | VARNAMES]
[ LRECL = n]
[ NOLABELS ]
[ PREFIX | PROCSQL=[name] 'prefix-imp' , [name] 'prefix-exp']
[ SAMPLE = fraction ]
[ SORT = [ (n) ] variables [(A)|(D)], ...]
[ VARIABLES = varlist | ALL]
EXPORT
|
Specifies two files to create. 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 where appropriate.
The second file is a fixed format data file, containing the data from the procedure table. This file is
referenced in the If a filename is enclosed in quotes, it is processed 'as is'. If a filename is not in quotes, a full prefix is generated for the file. If the PREFIX clause is specified, the data filename must be specified in quotes.
|
BLANKUND
| Treats SIR BLANK missing values as SAS undefined in the data file. That is, if the SIR value is missing value BLANK then the data are written as "." (dot). If this is not specified, any blank missing value is output as missing value number 1 and written as "A.". |
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. |
FILENAME
| Puts the given SAS file attribute on the SAS data step INFILE command. It is up to the SAS user to define where this name points. If a PREFIX clause is specified, this clause should not be specified. |
FORMAT
|
By default, 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. Specify the VARNAMES keyword to use the variable name as the format name, with a $ prepended for string variables, an X prepended for names that do not start with a character and an X appended for variable names that end with a number. If the generated name exceeds 32 characters the name is truncated but any trailing, generated X is preserved.
|
LRECL
|
An LRECL parameter is generated on the SAS INFILE command. Use the LRECL
parameter to override the system generated value. It must be greater than 50.
|
NOLABELS
|
Specifies that variable and value labels are not written to the SAS file.
|
PREFIX
( PROCSQL is a synonym for the PREFIX clause)
|
Specifies directory names for the data input file and for the location of the created SAS dataset. Specify a name
and a directory. If the names are not specified, the defaults are DATIMP and DATEXP
respectively.
A
sas save file export = 'proc.sas', 'data.sas' BLANKUND FORMAT = VARNAMES PREFIX = INNAME "C:\location of raw data\", OUTNAME "C:\target location of sas data\"The generated SAS procedure includes: PROC SQL; %let INNAME=C:\location of raw data\; libname OUTNAME 'C:\target location of sas data\'; DATA OUTNAME.data; INFILE "&INNAME.data.sas" |
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.
|
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