EXPORT Procedure

PROC EXPORT Statement

Exports SAS data sets to an external data file.

Syntax

Required Arguments

DATA=<libref.>SAS data set
identifies the input SAS data set with either a one- or two-level SAS name (library and member name). If you specify a one-level name, by default, the EXPORT procedure uses either the USER library (if assigned) or the WORK library.
The EXPORT procedure can export a SAS data set only if the data target supports the format of a SAS data set. The amount of data must also be within the limitations of the data target. For example, some data files have a maximum number of rows or columns. Some data files cannot support SAS user-defined formats and informats. If the SAS data set that you want to export exceeds the limits of the target file, the EXPORT procedure might not be able to export it correctly. In many cases, the procedure attempts to convert the data to the best of its ability. However, conversion is not possible for some types.
Default:If you do not specify a SAS data set to export, the EXPORT procedure uses the most recently created SAS data set. SAS keeps track of the data sets with the system variable _LAST_. To be certain that the EXPORT procedure uses the correct data set, you should identify the SAS data set.
OUTFILE="filename"
specifies the complete path and filename or a fileref for the output PC file, spreadsheet, or delimited external file. If you specify a fileref, or if the complete path and filename do not include special characters (such as the backslash in a path), lowercase characters, or spaces, you can omit the quotation marks. A fileref is a SAS name that is associated with the physical location of a file. To assign a fileref, use the FILENAME statement.
Alias:FILE
Restriction:The EXPORT procedure does not support device types or access methods for the FILENAME statement except for DISK. For example, the EXPORT procedure does not support the TEMP device type, which creates a temporary external file.
See:SAS/ACCESS Interface to PC Files: Reference for more information about PC file formats.
OUTTABLE="tablename"
specifies the table name of the output DBMS table. If the name does not include special characters (such as question marks), lowercase characters, or spaces, you can omit the quotation marks. Note that the DBMS table name might be case sensitive.
Requirements:You must have a license for SAS/ACCESS Interface to PC Files to export to a DBMS table.

When you export a DBMS table, you must specify the DBMS option.

Optional Arguments

DBMS=identifier
specifies the type of data to export. To export to a DBMS table, you must specify the DBMS option by using a valid database identifier. For DBMS=DLM, the default delimiter character is a space. However, you can use DELIMITER='char'.
The following values are valid for the DBMS identifier.
DBMS Identifiers Supported in Base SAS
Identifier
Output Data Source
Extension
CSV
Delimited file (comma-separated values)
.csv
DLM
Delimited file (default delimiter is a blank)
JMP
JMP files
.jmp
TAB
Delimited file (tab-delimited values)
.txt
Restriction:The availability of an output external data source depends on these conditions:
  • the operating environment, and in some cases the platform, as specified in the previous table.
  • whether your site has a license for SAS/ACCESS Interface to PC Files. If you do not have a license, only delimited and JMP files are available.
See:SAS/ACCESS Interface to PC Files: Reference for a list of additional DBMS identifiers when using SAS/ACCESS Interface to PC Files.
LABEL
specifies a variable label name. SAS writes these to the exported table as column names. If the label names do not already exist, SAS writes them to the exported table.
REPLACE
overwrites an existing file. If you do not specify REPLACE, the EXPORT procedure does not overwrite an existing file.
(SAS data set options)
specifies SAS data set options. For example, if the data set that you are exporting has an assigned password, you can use the ALTER=, PW=, READ=, or WRITE= data set options. To export a subset of data that meets a specified condition, you can use the WHERE option. For information about SAS data set options, see SAS Data Set Options: Reference.