BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Saket_90
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

1 REPLY 1
Reeza
Super User

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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 13229 views
  • 4 likes
  • 2 in conversation