Previous Page | Next Page

The IMPORT Procedure

Data Source Statements


Featured in: Examples: IMPORT Procedure

Delimited files have these valid data source statements:

When you license SAS/ACCESS Interface to PC Files, you have access to a greater number of statements and data types.

For more information about optional statements for delimited files, see the IMPORT and EXPORT Procedure Statements for Delimited Files in SAS/ACCESS for Relational Databases: Reference.


Statements for PC Files, Spreadsheets, or Delimited Files

Statements for Importing Delimited Files
Data Source Supported Syntax Valid Values Default Value
CSV DATAROW= 1 to 32767 2 *
GETNAMES= YES|NO YES
GUESSINGROWS= 1 to 32767 20
DLM DATAROW= 1 to 32767 2 *
DELIMITER= 'Char'|'nn'x space
GETNAMES= YES|NO YES
GUESSINGROWS= 1 to 32767 20
TAB DATAROWS= 1 to 32767 2 *

1 The default value of the DATAROW option is dependent upon the specification of the GETNAMES option. For more information, see the DATAROW statement below.



DATAROW

starts reading data from the specified row number in the delimited text file.

Valid values: 1 to 32767
Default: when GETNAMES=NO: 1 when GETNAMES=YES: 2
Restrictions: When GETNAMES=NO, DATAROW must be equal to or greater than 1.

When GETNAMES=YES, DATAROW must be equal to or greater than 2.

See also: GETNAMES

DELIMITER

specifies the delimiter that separates columns of data in the input file. You can specify the delimiter as a single character or as a hexadecimal value. For example, if columns of data are separated by an ampersand, specify DELIMITER='&'. If you do not specify DELIMITER=, the IMPORT procedure assumes that the delimiter is a space.

Valid values: char|nn|x|space
Default: space

GETNAMES

specifies whether the IMPORT procedure generate SAS variable names from the data values in the first record in the input file.

Valid values: YES|NO
Restriction: If the column names in the first record in the input file are not valid SAS names, then the IMPORT procedure uses default variable names.
Note: If a data value in the first record in the input file is read and it contains special characters that are not valid in a SAS name, such as a blank, then SAS converts the character to an underscore. For example, the column name Occupancy Code would become the SAS variable name Occupancy_Code.
GUESSINGROWS

specifies the number of rows of the file to scan to determine the appropriate data type and length for the columns. The scan data process scans from row 1 to the number that is specified by the GUESSINGROWS option.

Valid values: 1 to 32767
Default: 20
Note: you can change the default value in the SAS Registry under SAS Registry [arrow] Products [arrow] Base [arrow] EFI [arrow] GuessingRows.
Restriction: the values should be greater than the value specified for DATAROW.

Previous Page | Next Page | Top of Page