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;

To import a Stata file, try:

proc import datafile=FILEREF
    out=LIBREF.TABLE;
run;

GetNames Statement

The GETNAMES statement is almost always useful for text data.

GuessingRows Statement

The IMPORT procedure guesses the format of each variable based on peaking ahead some number of cases (controlled by the GUESSINGROWS statement). The best solution is usually setting this parameter to MAX.

If SAS consistently fails to guess the import format of data, consider copying the syntax generated by the IMPORT procedure and manually correcting it.


CategoryRicottone

SAS/Import (last edited 2024-11-17 23:37:45 by DominicRicottone)