02.05.2013 Views

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SAS(R) 9.1.3 Companion for z/OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

92 Reading from External Files Chapter 5<br />

(See “PRINTTO Procedure” on page 332 and “Using the PRINTTO Procedure and<br />

the FORM Subsystem” on page 117 <strong>for</strong> in<strong>for</strong>mation about PROC PRINTTO.) In<br />

either case, this file contains carriage-control characters by default. You can<br />

suppress the carriage-control characters by specifying the NOPRINT option in the<br />

FILE statement (see “Writing to External Files” on page 85).<br />

3 Use the letter A as part of the value in the RECFM= option in the FILE statement:<br />

file saveit recfm=vba;<br />

As in the FILENAME statement or FILENAME function, the letter A in the<br />

RECFM= option of the <strong>SAS</strong> FILE statement causes <strong>SAS</strong> to include<br />

carriage-control characters in the data set that is being created. <strong>SAS</strong> also changes<br />

the record <strong>for</strong>mat of the target data set.<br />

For in<strong>for</strong>mation about how to process print files as input, see “Reading from Print<br />

Data Sets” on page 97.<br />

Designating a Print Data Set as a Nonprint Data Set<br />

The NOPRINT option is useful when you use a DATA step to copy a data set that<br />

already contains carriage-control in<strong>for</strong>mation. In this case, use NOPRINT to prevent<br />

<strong>SAS</strong> from adding an additional column of carriage-control in<strong>for</strong>mation.<br />

If a data set has been allocated as a print data set, you can use the NOPRINT option<br />

in the FILE statement to omit carriage-control in<strong>for</strong>mation. For example, suppose you<br />

specified RECFM=VBA, indicating a print data set, when you allocated a file and that<br />

you assigned the fileref OUTDD. The following <strong>SAS</strong> statement designates OUTDD as a<br />

nonprint data set:<br />

file outdd noprint;<br />

To write lines without carriage-control in<strong>for</strong>mation to the <strong>SAS</strong> procedure output file,<br />

specify:<br />

file print noprint;<br />

Reading from External Files<br />

After you allocate an external file, you can read from the file in a <strong>SAS</strong> DATA step by<br />

specifying it in the INFILE statement, the INCLUDE command, or the %INCLUDE<br />

statement.<br />

This section describes the INFILE statement. For in<strong>for</strong>mation about the INCLUDE<br />

command, the %INCLUDE statement, and the DATA step, see <strong>SAS</strong> Language<br />

Reference: Dictionary.<br />

INFILE Statement<br />

In a <strong>SAS</strong> DATA step, the INFILE statement specifies which external file is to be<br />

read by a subsequent INPUT statement. Every external file that you want to read must<br />

have a corresponding INFILE statement. The external file can be a sequential data set<br />

on disk or tape, a member of a partitioned data set (PDS or PDSE), or any of several<br />

nonstandard file types (see the description of the type argument in “INFILE Statement<br />

Syntax” on page 93). The file can also be entered from a terminal.<br />

The INFILE statement is executable. There<strong>for</strong>e, it can be used in conditional<br />

processing–in an IF/THEN statement, <strong>for</strong> example.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!