Read File on SAS – Part 2

Another method to access to the file in your library using PROC IMPORT statement.

As usual, we will need to create a library statement to tell SAS where we keep our collection of datasets before we use PROC IMPORT to access the particular data file.

libname SAS “I:\SAS\Sample Folders”;

TITLE "Part II";

PROC IMPORT DATAFILE=“I:\SAS\Sample Folders\data.csv”





The code above indicates:

  • PROC IMPORT DATAFILE=“I:\SAS\Sample Folders\data.csv”
    • <to tell SAS where to get the particular dataset through the complete path and filename>
    • <to identify the SAS output through library name and datafile name>
    • <SAS = library name>
    • <data = datafile name>
    • <DBMS = to specify type of data imported>
    • <replace = to overwrite an existing dataset, which is often used to ensure updated dataset overwrite the old & existing dataset>
    • <to generate variable names from the data values>
    • <applicable only with PROC IMPORT>
    • <to indicate no of rows to process in order to determine the datatype and length of each variable>
    • <applicable only for CSV/delimited data file>



Categories: SAS Learning

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: