Referencing a Raw Data File

Using a FILENAME Statement

Use the FILENAME statement to point to the location of the external file that contains the data.
Filerefs perform the same function as librefs: they temporarily point to a storage location for data. However, librefs reference SAS libraries, whereas filerefs reference external files.
Syntax, FILENAME statement:
FILENAME fileref 'filename';
  • fileref is a name that you associate with an external file. The name must be 1 to 8 characters long, begin with a letter or underscore, and contain only letters, numbers, or underscores.
  • 'filename' is the fully qualified name or location of the file.

Defining a Fully Qualified Filename

The following FILENAME statement temporarily associates the fileref Exercise with the external file that contains the data from the exercise stress tests. The complete filename is specified as C:certdataTmill.dat in the Windows operating environment.
filename exercise 'c:certdata	mill.dat';
Figure 6.2 File Location
File Location

Referencing a Fully Qualified Filename

When you associate a fileref with an individual external file, you specify the fileref in subsequent SAS statements and commands.
Figure 6.3 Referencing a Fully Qualified Filename
Referencing a Fully Qualified Filename

Defining an Aggregate Storage Location

An aggregate storage location contains multiple external files. To define an aggregate storage location, use the FILENAME statement to associate a fileref.
filename tax 'c:clinic
evenue';
This FILENAME statement temporarily associates the fileref Tax with the aggregate storage directory C:clinic evenue.

Referencing a File in an Aggregate Storage Location

To reference an external file with a fileref that points to an aggregate storage location, specify the fileref followed by the individual filename in parentheses.
Figure 6.4 Referencing a File in an Aggregate Storage Location
Referencing a File in an Aggregate Storage Location
Tip
If the file extension is omitted, SAS looks for a .dat file.
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.42.243