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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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