SAS Import

A utility procedure for generating a data step that imports a data file.


Usage

to import a CSV file, try:

proc import datafile=FILEREF
    out=LIBREF.TABLE
    dbms=csv;
  getnames=yes;
run;

GetNames Statement

Generally the GETNAMES statement should always be used. See above.

GuessingRows Statement

The IMPORT procedure guesses the format of each variable based on peaking ahead and observing values. This can lead to issues when numeric and character values are mixed. The best solution is usually the GUESSINGROWS statement.

proc import datafile=data_v2
                out=work.raw
                dbms=csv;
        guessingrows=max;
run;

GUESSINGROWS can be set to any positive integer or MAX.

If this also fails, consider copying the syntax generated by the IMPORT procedure and manually correcting it.


CategoryRicottone

SAS/Import (last edited 2023-03-30 20:05:39 by DominicRicottone)