DATA Step, Macro, Functions and more

Put _infile_ Statement

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Put _infile_ Statement

Hi All,

 

I am new to SAS and trying to understand what does Put _infile_ Statement means?

 

Also If someone can help to understand what does input; means? As we have not declared any variable.

 

data _null_;  

infile XYZ; 

input ;  

put _infile_;

run;

 

Warm Regards,

Saket


Accepted Solutions
Solution
‎05-10-2016 06:14 AM
Super User
Posts: 19,822

Re: Put _infile_ Statement

Input tells SAS to read a line from the file.

 

_infile_ is the automatic variable that contains the input - usually the entire line but you can run into issues if the line is longer than expected. 

 

See the documentation of PUT with the variable _infile_.

 

http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn...

 


_INFILE_
writes the last input data record that is read either from the current input file or from the data lines that follow a DATELINES statement.
Tips:_INFILE_ is an automatic variable that references the current INPUT buffer. You can use this automatic variable in other SAS statements.
If the most recent INPUT statement uses line-pointer controls to read multiple input data records, PUT _INFILE_ writes only the record that the input pointer is positioned on.
Example:This PUT statement writes all the values of the first input data record:
input #3 score #1 name $ 6-23;
put _infile_;
Example:Writing the Current Input Record to the Log
_ALL_
writes the values of all variables, which includes automatic variables, that are defined in the current DATA step by using named output.
See:Named Output

View solution in original post


All Replies
Solution
‎05-10-2016 06:14 AM
Super User
Posts: 19,822

Re: Put _infile_ Statement

Input tells SAS to read a line from the file.

 

_infile_ is the automatic variable that contains the input - usually the entire line but you can run into issues if the line is longer than expected. 

 

See the documentation of PUT with the variable _infile_.

 

http://support.sas.com/documentation/cdl/en/lestmtsref/63323/HTML/default/viewer.htm#n1spe7nmkmi7ywn...

 


_INFILE_
writes the last input data record that is read either from the current input file or from the data lines that follow a DATELINES statement.
Tips:_INFILE_ is an automatic variable that references the current INPUT buffer. You can use this automatic variable in other SAS statements.
If the most recent INPUT statement uses line-pointer controls to read multiple input data records, PUT _INFILE_ writes only the record that the input pointer is positioned on.
Example:This PUT statement writes all the values of the first input data record:
input #3 score #1 name $ 6-23;
put _infile_;
Example:Writing the Current Input Record to the Log
_ALL_
writes the values of all variables, which includes automatic variables, that are defined in the current DATA step by using named output.
See:Named Output
☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 1493 views
  • 0 likes
  • 2 in conversation