The EXPORT Procedure |
Featured in: | Examples: EXPORT Procedure |
PROC EXPORT
DATA=<libref.>SAS data-set <(SAS data-set-options)> OUTFILE="filename" | OUTTABLE="tablename" <DBMS=identifier> <LABEL><REPLACE>; |
Required Arguments |
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. |
Featured in: | Examples: EXPORT Procedure |
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 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 "Data Set Options" in the SAS Language Reference: Dictionary.
Featured in: | Exporting a Subset of Observations to a CSV File |
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. For more information about PC file formats, see SAS/ACCESS Interface to PC Files: Reference.
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. |
Featured in: | Exporting a Delimited External File and Exporting a Subset of Observations to a CSV File. |
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.
Requirement: | When you export a DBMS table, you must specify the DBMS option. |
Options |
specifies the type of data to export. To export a DBMS table, you must specify the DBMS option by using a valid database identifier. Valid identifiers for delimited data files are CSV, DLM, and TAB. For DBMS=DLM, the default delimiter character is a space. However, you can use DELIMITER='char'
The following values are valid for the DBMS= option:
Restriction: |
The availability of an output external
data source depends on these conditions:
|
Featured in: | Exporting a Delimited External File |
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.
overwrites an existing file. If you do not specify REPLACE, the EXPORT procedure does not overwrite an existing file.
Featured in: | Exporting a Subset of Observations to a CSV File |
Data Source Statements |
specifies the delimiter to separate columns of data in the output file. You can specify the delimiter as a single character or as a hexadecimal value. For example, if you want columns of data to be separated by an ampersand, specify DELIMITER='&'. If you do not specify the DELIMITER option, the EXPORT procedure assumes that the delimiter is a blank.
Featured in: | Exporting a Delimited External File |
Interaction: |
You do not have to specify the DELIMITER
option if
|
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.