ARCHIVED: In SAS on Unix, how can I import a data file into non-interactive sessions?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

SAS can import database, spreadsheet, or delimited ASCII files using the PROC IMPORT procedure. In Unix, PROC IMPORT assumes an X Window session; thus, you must use the -noterminal option when running a SAS command file with PROC IMPORT in non-interactive, background, or batch mode.

Suppose you have a SAS command file named myimport.sas with the lines below. It imports an external data file, mydata.dat, from the working directory, and generates a permanent SAS system file, mydata.sas7bdat, in the ~/sasdata directory:

  LIBNAME import '~/sasdata';
  PROC IMPORT DATAFILE='mydata.dat'
       OUT=import.mydata
       DBMS=dlm
       REPLACE;
       GETNAMES=YES;
       DATAROW=2;
  RUN;

To execute the file in non-interactive mode, at the Unix prompt, enter:

 sas -noterminal myimport.sas

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document alrg in the Knowledge Base.
Last modified on 2023-05-09 14:44:52.