Chapter Contents

Previous

Next
The EXPORT Procedure

PROC EXPORT Statement


Featured in: All examples

PROC EXPORT DATA=SAS-data-set
OUTFILE=filename| OUTTABLE=table-name
<DBMS=identifier> <REPLACE>;


Required Arguments

DATA=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, PROC EXPORT assumes the WORK library.
Featured in: All examples

OUTFILE="filename"
specifies the complete path and filename of the output PC file, spreadsheet, or delimited external file. If the name does not include special characters (like the backslash in a path), lowercase characters, or spaces, you can omit the quotes.
Featured in Exporting a Delimited External File and Exporting to an Excel Spreadsheet

OUTTABLE="tablename"
specifies the table name of the output DBMS table. If the name does not include special characters (like question marks), lowercase characters, or spaces, you can omit the quotes. Note that the DBMS table name may be case-sensitive.
Requirement: When you export a DBMS table, you must specify the DBMS= option.
Featured in: Exporting a Microsoft Access Table


Options

DBMS=identifier
specifies the type of data to export. For example, DBMS=DBF specifies to export a dBASE file. For PC files, spreadsheets, and delimited external files, you do not have to specify DBMS= if the filename specified with OUTFILE= contains a valid extension so that PROC EXPORT can recognize the type of data. For example, PROC EXPORT recognizes the filename ACCOUNTS.WK1 as a Lotus 1 spreadsheet and the filename MYDATA.CSV as a delimited external file that contains comma-separated data values. When you specify DBMS=EXCEL, PROC EXPORT assumes that the output data source is an Excel Version 5 spreadsheet. Therefore, to export to an Excel 4 spreadsheet, specify DBMS=EXCEL4, and to export to an Excel 97 spreadsheet, specify DBMS=EXCEL97.

To export a DBMS table, you must specify DBMS= using a valid database product. For example, DBMS=ACCESS exports a Microsoft Access table.

If you do not specify an identifier or if the extension of the filename is not recognized, an error is returned.

The DBMS= specification can include the values listed in the following table:

Available DBMS Specifications
Identifier Output Data Source Extension
ACCESS Microsoft Access database .MDB
DBF dBASE files .DBF
WK1 Lotus 1 spreadsheet .WK1
WK3 Lotus 3 spreadsheet .WK3
WK4 Lotus 4 spreadsheet .WK4
EXCEL Excel Version 5 spreadsheet .XLS
EXCEL4 Excel Version 4 spreadsheet .XLS
EXCEL5 Excel Version 5 spreadsheet .XLS
EXCEL97 Excel 97 spreadsheet .XLS
DLM delimited file (default delimiter is a blank) .*
CSV delimited file (comma-separated values) .CSV
TAB delimited file (tab-delimited values) .TXT

Restriction: The data sources available to you depend on which SAS/ACCESS products you have licensed. If you do not have any SAS/ACCESS products licensed, then the only type of data source files available to you are .CSV, .TXT, and delimited files.
Restriction: The OS/2 operating environment does not support Excel 5 and Excel 97 spreadsheets.
Comparison: When you specify DBMS=EXCEL

  • PROC EXPORT identifies the output data source only as an Excel Version 5 spreadsheet.

  • PROC IMPORT distinguishes between Excel Version 4 and Version 5 spreadsheets.

Featured in: Exporting a Delimited External File and Exporting a Microsoft Access Table

Note:   If you export a SAS data set that contains missing values (for either character or numeric values) to a dBASE file (DBF), the missing values are translated to blanks.  [cautionend]

REPLACE
overwrites an existing file. If you do not specify REPLACE, PROC EXPORT does not overwrite an existing file.
Featured in: Exporting a Microsoft Access Table


Chapter Contents

Previous

Next

Top of Page

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