
With the LIBNAME statement below, we create the library my_xlsx that refers to the Excel file cars.xlsx.1 Learning SAS by Example A Programmer s Guide Ron Cody SAS PressĢ From Learning SAS by Example. However, if you use the XLSX engine, then a library is one Excel file where the “datasets” are the worksheets of the file.
#HOW TO DOWNLOAD SAS PROGRAM TO EXCEL HOW TO#
#HOW TO DOWNLOAD SAS PROGRAM TO EXCEL CODE#
The SAS code below exports the work.my_data dataset to Excel and creates a file called cars.xlsx.Įxport data from SAS to Excel with the LIBNAME Statement The LIBNAME StatementĪ less known, but also very efficient way to export data from SAS to Excel is by creating a library with the LIBNAME statement. For example, if you export data to Excel, the SAS dataset cannot exceed the maximum of 1,048,576 rows and 16,384 columns. It depends on the file type how much data SAS can export. The DBMS=-option specifies the type of file the EXPORT procedure creates (e.g. Keep in mind that the complete path (location and file name) can’t exceed 201 characters. The OUTFILE=-option specifies the location and file name of the exported dataset.

When you export a dataset to Excel, you can use dataset options such as KEEP, RENAME, and WHERE in the DATA=-option. You can either use a one- or two-level SAS name (i.e., with or without libref).

The DATA=-option specifies the SAS dataset you want to export.

To export data from SAS to Excel with PROC EXPORT you need to define at least three parameters: This procedure is easy-to-understand and provides many options. Export data from SAS to Excel with PROC EXPORT The EXPORT ProcedureĪn easy way to export a table from SAS to Excel is with the EXPORT procedure (PROC EXPORT).
