DATA Step, Macro, Functions and more

Reading Raw data file using double trailing @@

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Reading Raw data file using double trailing @@

I have a raw data file charity.dat which I have attached with this question. This file contains data about donations made. It contains a charity ID and amount. Following is the code which i have wrote to read the data.

data donate07;

     length ID $4.;
     infile 'E:\SAS data\Data\base data set\lwprg2\charity.dat';
     input ID $ Amount @@;
     run;

In the raw data file you can see that the amount 875 is at the starting of the third line. My question here is when during execution line pointer reaches the end of the second data line it wont be able to find amount for that corresponding charity id, therefore in output data set the value of amount there should be  a period,since according to my understanding @@ will block the input buffer until the line pointer reaches end of the dataline currently being read. but in output I can see that the data was read correctly and in logs i can see 

NOTE: SAS went to a new line when INPUT statement reached past the end of a line.

Can anybody please help me in understanding this concept.

 

 

 

 

 

 

 

 

 


charity.jpg

Accepted Solutions
Solution
‎08-01-2016 04:22 PM
Super User
Posts: 11,343

Re: Reading Raw data file using double trailing @@

[ Edited ]
Posted in reply to ashish_197

There is a default option for infile, FLOWOVER. If the current input statement is trying to read more variables than are currently available then it continues on the next line which generates the warning. The note is basically to let you know something may be going on in your data you possibly didn't expect.

So with two variables on the input coupled with trailing @@ the input reads the first two values, then the nex two etc. When it gets to the end of the second line there is only one value to read so it is read and then the advance to the next line. And continues to the end of the data.

 

 

View solution in original post


All Replies
Solution
‎08-01-2016 04:22 PM
Super User
Posts: 11,343

Re: Reading Raw data file using double trailing @@

[ Edited ]
Posted in reply to ashish_197

There is a default option for infile, FLOWOVER. If the current input statement is trying to read more variables than are currently available then it continues on the next line which generates the warning. The note is basically to let you know something may be going on in your data you possibly didn't expect.

So with two variables on the input coupled with trailing @@ the input reads the first two values, then the nex two etc. When it gets to the end of the second line there is only one value to read so it is read and then the advance to the next line. And continues to the end of the data.

 

 

SAS Super FREQ
Posts: 8,864

Re: Reading Raw data file using double trailing @@

Hi, this isn't a warning. It is a NOTE. It is describing exactly what happened. So, for example, see this screen shot:

 

read_charity.png

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 403 views
  • 3 likes
  • 3 in conversation