Cornell University Cornell University CISER

CISER Computing

Reading Comma-Delimited Raw Data Files

Q.  My raw data came from a speadsheet and when I saved it as text, it put commas between every column.  Can I read the file into SAS?

A. Yes!  There is an INFILE option called DSD that will make reading this file quite simple.  DSD option changes the default delimiter to a comma. When you specify DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values.

Example to read a comma delimited file:

filename in 'c:\my proj\rawdata.txt';     /* this is your raw data file */
    data new;
       infile in dsd;
       input var1-var20;