Database Reference
In-Depth Information
Figure 3.5a: The SAS Dataset Created by the Code Above.
Example 3.6 PROC IMPORT Using the DBMS=XLS or XLSX to Select Rows
This example uses the PROC IMPORT option pairs STARTROW= / ENDROW= and STARTCOL= /
ENDCOL= to show you how you can select a range of cells from an Excel worksheet without creating a named
range in an Excel workbook. When the NAMEROW=, GETNAMES=, and RANGE= statements are added to
the mix, you can pick names for your variable from inside the Excel file without needing a second pass over the
dataset or the need to use PROC DATASETS. The text values with spaces embedded in the value have had an
underscore added to replace the space in the variable name. Also, ENDROW= was placed before
STARTROW= to show the statement order in not important. The output SAS dataset has data from three
columns and five rows of the input Excel worksheet.
PROC IMPORT
DATAFILE='c:\My_Files\Shoes.xls'
DBMS=XLS
OUT=shoes
REPLACE;
ENDCOL="4"; /* a quoted string is required */
STARTCOL="2"; /* a quoted string is required */
ENDROW=10; /* numeric value is required */
STARTROW=6; /* numeric value is required */
NAMEROW=1;
GETNAMES=NO;
RUN;
 
Search WWH ::




Custom Search