Database Reference
In-Depth Information
syntax of the RANGE= option; the “named-constants” are not required when a range-name is used with the
RANGE= statement.
Example 3.4 - Part 1
The following SAS code reads a full worksheet from an Excel file on a 64-bit computer; the DBMS=EXCELCS
option uses the SAS PC Files Server to access and read the input Excel 32-bit workbook.
PROC IMPORT
DATAFILE='c:\My_Files\Shoes.xlsb'
DBMS=EXCELCS
OUT=shoes
REPLACE;
RANGE='SHOES$'n;
RUN;
Example 3.4 - Part 2
The following segment of SAS code, while syntactically correct, reads the first row of data as variable names
and produces unpredictable results because GETNAMES= is not supported when DBMS=EXCELCS. This
code is intended to read three rows of data from the input Excel file. However, the first row is interpreted as
SAS variable names.
NOTE: The RANGE= value includes Excel cell references, which may not produce your desired output
because the GETNAMES= statement is not supported when using the DBMS=EXCELCS option. I suggest that
you use the DBMS=XLSX option instead, as shown in Example 3.5. This example shows what happens if you
do not use the DBMS=XLSX statement.
/* this code does not work */
PROC IMPORT
DATAFILE='c:\My_Files\Shoes.xlsb'
DBMS=EXCELCS
OUT=shoes
REPLACE;
RANGE='shoes$C2:F4'n;
RUN;
Figure 3.4 shows the output SAS dataset generated by the PROC IMPORT code from above. The intended
result was to read three data rows into the SAS dataset. However, the first row was read and translated into
variable names.
Figure 3.4: The SAS Dataset Created by the Code Above .
 
Search WWH ::




Custom Search