DATA Step, Macro, Functions and more

Input statement

Posts: 24

Input statement


This is a code from the Sas website:

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

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

Can someone please explain this data step?
Trusted Advisor
Posts: 2,125

Re: Input statement

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,

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
Posts: 24

Re: Input statement

Thanks! It was helpful.
Valued Guide
Posts: 765

Re: Input statement

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

then try: "More _Infile_ Magic"
Peter Crawford
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation