Chapter Contents

Previous

Next
SAS Companion for the OS/390 Environment

Referring to External Files

After allocating an external file, you can use the fileref or DDname of the file as a convenient way of referring to that file in any subsequent SAS language statement or command. (Note: The first time the DDname of an external file is used in a SAS statement or procedure, SAS assigns it as a fileref for the external file. Therefore, any information provided here about filerefs also applies to the DDnames of external files.) In the following example, the FILENAME statement associates the fileref REPORT with the sequential data set MYID.NEWDATA. The FILE statement later uses the fileref rather than the data set name to refer to the data set.

filename report 'myid.newdata' disp=old;
data _null_;
   file report;
   put ...;
run;

Here is a similar example in which a JCL DD statement associates the DDname IN with a member of a partitioned data set. The INFILE statement later uses the DDname rather than the data set name and member name to refer to the PDS member.

//IN DD DSN=MYID.NEWDATA(TRIAL1),DISP=SHR
//SYSIN DD *
data out;
   infile in;
   input ...;
run;

When referring to a member of a PDS or a PDSE, you also have the option of specifying only the data set name in the FILENAME statement (or FILENAME function) or in the DD statement. Then, in subsequent references, you specify the member name with the fileref. For example:

//IN DD DSN=MYID.NEWDATA,DISP=SHR
//SYSIN DD *
data out;
   infile in(trial1);
   input ...;
run;

If an external data set is not cataloged, you must also provide the volume serial number. See FILENAME for more information about other options that you can specify.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.