BookmarkSubscribeRSS Feed
JatinRai
Obsidian | Level 7
Hi

This is a code from the Sas website:

data _null_;
infile file-specification-1;
file file-specification-2;
input;
put _infile_;
run;

What is _infile_ over here and what does it do? Is it an automatic variable like _all_?

Can someone please explain this data step?
3 REPLIES 3
Doc_Duke
Rhodochrosite | Level 12
It's easier to help if you cite where you found the code. That way we can comment in context.

Basically, the DATA step takes the data from file 1 and puts it into file 2. It is different from a simple OS copy in that it can do some rudimentary code translation for different environments (depending on the additional parameters specified in the INFILE and FILE statements).

The _INFILE_ automatic variable is documented with the INFILE statement,
http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000146932.htm

The way I have most commonly used this is to create a hex print of the INFILE buffer when I am trying debug some messy data problem.

Doc Muhlbaier
Duke
JatinRai
Obsidian | Level 7
Thanks! It was helpful.
MikeZdeb
Rhodochrosite | Level 12
hi ... in addition to the SAS documentation, you can learn a lot about uses of _INFILE_ by reading ...

first: "Now _INFILE_ is an Automatic Variable − So What?"
Howard Schreier

http://www.nesug.org/proceedings/nesug01/cc/cc4018bw.pdf

then try: "More _Infile_ Magic"
Peter Crawford

http://www2.sas.com/proceedings/sugi28/086-28.pdf

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
  • 3 replies
  • 904 views
  • 0 likes
  • 3 in conversation