Inputting Data Using the INFILE Statement Rather than the DATALINES Statement

When working with a very large dataset, it might be more convenient to input data using the INFILE statement rather than the DATALINES statement. This involves:

  • adding an INFILE statement to your program;

  • placing your data lines in a second computer file, rather than in the file that contains your SAS program;

  • deleting the DATALINES statement from your SAS program.

Your INFILE statement should appear after the DATA statement but before the INPUT statement. The general form for a SAS program using the INFILE statement is as follows:

DATA dataset-name; INFILE 'name-of-data-file' ; INPUT #line-number @column-number variable-name column-width. @column-number variable-name ...

Get A Step-by-Step Approach to Using SAS® for Univariate & Multivariate Statistics, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.