Understanding INPUT PROGRAM

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Understanding INPUT PROGRAM

Scott Hample
I was looking at some old syntax of a colleague's and don't quite understand
what the "INPUT PROGRAM" section of the syntax is doing.

Please help me understand.

Thanks!

get file =  !path1 + 'student.sav'
/keep datatel.


WRITE OUTFILE='T:\work\data.dat'
  TABLE /ALL .
EXECUTE.


INPUT PROGRAM.
DATA LIST FILE = !path1 + 'data.dat'   /datatel 1 - 8.
compute temp = 0.
leave datatel temp.
set mxloops = 54.
Loop.
Compute temp = temp+1.
end case.
end loop if (temp eq 20).
End input program.
execute.

Thanks!
Scott
Reply | Threaded
Open this post in threaded view
|

Re: Understanding INPUT PROGRAM

Richard Ristow
At 10:32 AM 12/1/2006, Scott Hample wrote:

>I don't quite understand what the "INPUT PROGRAM" section of the
>[following] syntax is doing.
>
>INPUT PROGRAM.
>.  DATA LIST FILE = !path1 + 'data.dat'
>        /datatel 1 - 8.
>.  compute temp = 0.
>.  leave datatel temp.
>.  set mxloops = 54.
>.  Loop.
>.     Compute temp = temp+1.
>.     end case.
>.  end loop if (temp eq 20).
>End input program.

(I've reformatted a little, with pseudo-indents.)

If I read this right, the INPUT PROGRAM creates records ('cases') with
exactly two variables: "datatel" and "temp".

For each "datatel" value it reads from the input file, it creates 20
such cases, with values of "temp" running from 1 through 20.
Reply | Threaded
Open this post in threaded view
|

Re: Understanding INPUT PROGRAM

Scott Hample
In reply to this post by Scott Hample
Thanks Richard!

Scott Hample