Sas.dat file without column headers. Only the first line is read in sas studio

I am using Sas University Edition. I have a data file with no column headers (4 columns). I am trying to read it with

data van;
    infile "/folders/myfolders/test2/psek-win.dat";
    input a $ b $ c $ d $;
run;

      

i.e. create my own names for columns. It works, but only the first line is read. How can I get it to read all lines? I've watched YouTube tutorials but I'm stuck.

EDIT: Outputted here

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 57         
 58         data van;
 59             infile "/folders/myfolders/test2/psek-win.dat";
 60             input a $ b $ c $ d $;
 61         run;

 NOTE: The infile "/folders/myfolders/test2/psek-win.dat" is:
       Filename=/folders/myfolders/test2/psek-win.dat,
       Owner Name=sasdemo,Group Name=sas,
       Access Permission=-rw-rw-r--,
       Last Modified=05Jun2015:06:55:44,
       File Size (bytes)=1527

 NOTE: 1 record was read from the infile "/folders/myfolders/test2/psek-win.dat".
       The minimum record length was 1527.
       The maximum record length was 1527.
 NOTE: The data set WORK.VAN has 1 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds


 62         
 63         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 75      

      

EDIT 2: I really should have included this information from the start ... sorry: I am using Windows 7, running Sas Studio via VirtualBox on Linux Redhat 64. I figured out that the file I was using was for Windows. When I use the Linux version of the same file, it works great.

thank

+3


source to share


2 answers


I realized that the file I was using was for Windows. When I use the Linux version of the same file, it works great. thanks for the help



0


source


In most cases, if SAS only reads one line and then acts as if it were executing when it had many lines, it is a line terminator (i.e. line terminator) issue).

Windows uses CR + LF ( 0D0A

) while Unix / Linux uses 0A

(LF), including Mac OS X.

This means that if you are on a Windows machine and have a Unix terminated file, it will be read as if it had only one line. The other way is not a problem - you end up with an extra character, which might mess up a bit, but it still acts as if it were the correct number of lines.



You can change this in datastep by giving a parameter termstr=

to specify the correct line terminator. For example:

data van;
    infile "/folders/myfolders/test2/psek-win.dat" termstr=lf;
    input a $ b $ c $ d $;
run;

      

Asks SAS to consider a simple stream of lines as a line terminator.

+3


source







All Articles