Database Reference
In-Depth Information
Figure 4.9.3: SAS Enhanced Editor and Explorer Windows Showing Excel Worksheet
References.
The next step, after verifying there are no errors on the log, is to look at the Excel file Figure 4.9.4 to see
what was generated. Notice that the SAS variable names were used as the Excel column headers in row 1.
Columns with numbers are right-justified, and columns with text values are left-justified. Multiple SAS
DATA steps can write to the same Excel workbook defined by one LIBNAME statement. However, each
DATA step or procedure must write to a separate worksheet. The LIBNAME statement does not support a
REPLACE option.
Figure 4.9.4: Data Written to an Excel Worksheet.
Figure 4.9.4 Excel file contents after the cells were widened to show the full dollar amounts in the columns.
Also notice that the sheet name is “sheet1” not “Sheet1” because the named constant generates a case-
sensitive sheet name.
Example 4.6 Using PROC CONTENTS to Examine an Excel Workbook
Figure 4.9.5a shows the SAS code to display the contents of the Excel file we created. First, we notice that
the Excel file has one worksheet, but the PROC CONTENTS output below shows two data tables, sheet1
and sheet1$. Next we ask “Why are there two sheets?” The answer is this: Excel has a feature called a
named-range that is a subset of the data on an Excel worksheet. SAS accounts for this by assigning a name
 
Search WWH ::




Custom Search