user2035158
user2035158

Reputation: 51

Default behavior of Input Buffer in SAS while reading data from external file

Contents of a.txt
22
333
4444
55555

But when i run this code :

data numbers;
infile ’c:\a.txt’;
input var 5.;
/* list */ ;
run;

the data in numbers.sas is saved as :

  333  
55555

** Note the format of the data in numbers.sas and the format in a.txt

But when i use the list the input buffer is somewhat like this :

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7  
2         333 3    
4         55555 5

Why doesnt sas show 1 and 3?? And how is the input buffer reading? Please explain

Upvotes: 2

Views: 274

Answers (1)

Laurent de Walick
Laurent de Walick

Reputation: 2174

Try adding TRUNCOVER to your infile statement or remove the 5. after your input statement. SAS now expects a 5 digit number. If will continue reading if the line on your sourcefile is less then 5 characters long.

data numbers;
infile 'c:\a.txt' truncover;
input var 5.;
run;

For more infor read this paper on infile statement options

Upvotes: 3

Related Questions