In addition to reading Microsoft
Excel data, SAS can also create Excel worksheets from SAS data sets.
-
If the Excel workbook does not
exist, SAS creates it.
-
If the Excel worksheet within the
workbook does not exist, SAS creates it.
-
If the Excel workbook and the worksheet
already exist, then SAS overwrites the existing Excel workbook and
worksheet.
In the following example,
you use the
SAS/ACCESS LIBNAME statement and the DATA step to create
an Excel worksheet. The
SAS/ACCESS LIBNAME statement specifies the
name of the new Excel file as newExcel.xlsx. The DATA step reads in
Cert.Stress and then creates the Excel worksheet HighStress in the
newExcel.xlsx workbook.
libname excelout xlsx 'C:UsersStudent1Cert
ewExcel.xlsx';
data excelout.HighStress;
set cert.stress;
run;
Output 4.12 Excelout.HighStress Worksheet