Sample 25972: Using FILENAME Statements to Access and Register External Files in SAS ETL Studio
An external file is a file that is created and maintained by a host operating system or by another vendor's software application. SAS ETL Studio provides external file Source Designer wizards that enable you to register external files in a metadata repository. After an external file is registered, you can add it to a SAS ETL Studio job as a source or a target.
A fileref is a reference to FILENAME statement. In the external file Source Designer wizards, you can use a fileref instead of a filename and path to specify the physical location of the external file. You can give the fileref a simple and descriptive name that will be easier to work with than filenames and paths, which are often long and complicated.
The FILENAME statement can be specified in two main ways:
- add it as a pre-process to the job that will contain the metadata for the external file
- add it to the autoexec.sas file on the SAS application server that is being used to access the file.
Note: If you use a fileref instead of a physical path in an external file Source Designer, features that depend on interactive access to the file will not work unless you add the FILENAME statement to the appropriate autoexec.sas file. These features include verifying that the file exists and viewing the contents of the file.
If you cannot add a FILENAME statement to the autoexec.sas file on the SAS application server that is being used to access the file, then you can add it as a pre-process to the job that will contain the metadata for the external file. To add a FILENAME statement as a pre-process to a job, open the Properties window for the job and go to the Pre and Post Processing tab. Add the FILENAME statement to the Pre-Processing section.
Follow these steps to use a fileref in an external file Source Designer wizard:
- From the SAS ETL Studio desktop, select Tools
Source Designer.
- From the Source Designer selection window, select the Delimited External File wizard or the Fixed Width External File wizard.
- From the External File Location window, enter the fileref in the File name field. Click Advanced to access the Advanced File Location Settings window.
- Click File Name Quoting, and select No quotes around file name. The fileref that is generated by your FILENAME statement cannot be read in the File name field of the External File Location window unless quotation marks are turned off.
- Finish processing the external file that is referenced by the fileref.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
In the external file Source Designer wizards, you can use a fileref instead of a filename and path to specify the physical location of the external file.
| Date Modified: | 2006-03-08 03:03:50 |
| Date Created: | 2005-08-19 15:25:30 |
Operating System and Release Information
| SAS System | SAS Data Integration Studio | Microsoft® Windows® for 64-Bit Itanium-based Systems | 9 TS M0 | n/a |