REDIRECT Statement


Points to different input or output SAS data sets when you execute a stored program

Valid: in a DATA step

Category: Action

Type: Executable

Requirement: You must specify the PGM= option in the DATA statement.

Syntax

REDIRECT INPUT OUTPUT old- name -1 = new-name-1 < old-name-n = new-name-n >;

Arguments

INPUT OUTPUT

  • specifies whether to redirect input or output data sets. When you specify INPUT, the REDIRECT statement associates the name of the input data set in the source program with the name of another SAS data set. When you specify OUTPUT, the REDIRECT statement associates the name of the output data set with the name of another SAS data set.

old-name

  • specifies the name of the input or output data set in the source program.

new-name

  • specifies the name of the input or output data set that you want SAS to process for the current execution.

Details

The REDIRECT statement is available only when you execute a stored program. For more information about stored programs, see Stored Compiled DATA Step Programs in SAS Language Reference: Concepts .

CAUTION:

  • Use care when you redirect input data sets. The number and attributes of variables in the input data sets that you read with the REDIRECT statement should match those of the input data sets in the MERGE, SET, MODIFY, or UPDATE statements of the source code. If the variable type attributes differ, the stored program stops processing and an appropriate error message is sent to the SAS log. If the variable length attributes differ , the length of the variable in the source code data set determines the length of the variable in the redirected data set. Extra variables in the redirected data sets do not cause the stored program to stop processing, but the results may not be what you expect.

Comparison

The REDIRECT statement applies only to SAS data sets. To redirect input and output stored in external files, include a FILENAME statement to associate the fileref in the source program with different external files.

Examples

This example executes the stored program called STORED.SAMPLE. The REDIRECT statement specifies the source of the input data as BASE.SAMPLE. The output data set from this execution of the program is redirected and stored in a data set named SUMS.SAMPLE.

 libname stored '  SAS-data-library  ';  libname base '  SAS-data-library  ';  libname sums '  SAS-data-library  ';  data pgm=stored.sample;     redirect input in.sample=base.sample;     redirect output out.sample=sums.sample;  run; 

See Also

Statement:

  • DATA Statement on page 1124

Stored Compiled DATA Step Programs in SAS Language Reference: Concepts




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net