This do loop works as follows:
do i=1 by 1 while (countc(outtxt,'~')<25);
input;
outtxt=catx(' ',outtxt,_infile_);
end;
The "do i=1 by 1 while (countc(outtxt,'~')<25 says to start doing doing something and keep doing the same thing (i.e. looping) as long as there less than 25 '~' in the outtxt variable. And what is the "thing" being repeatedly done? First, since every time the top of the data step starts, outtxt is reset to missing, it starts out with 0 '~'. So the do-loop is going to be iterated as least once. Inside the loop it does the following: - INPUT; /* reads a line, but populates no variable except automatic variable _INFILE_ which gets a direct copy of the input line. - CATX: Concatenates the content of OUTTXT (which starts out blank) with the contents of _INFILE_. For the first iteration, it's just copying _INFILE_ to OUTTXT. For all later iterations, it's appending _INFILE_ to the non-empty OUTTXT, separating them by a blank) So this loop keeps extending the content of OUTTXT - go back to top of the loop and rechecks the count of '~' in outtxt. Once it stops being <25 the looping stops and the subsequent statements are executed:
After the loop, the contents of OUTTXT is written to the target of the PUT statement. That target is the destination identified by the FILE statement.
... View more