SPSS Input Program
The INPUT PROGRAM declares a dataset using a logical program.
Contents
Usage
To declare a dataset using loops, try:
input program.
loop #i = 1 to 1000.
do repeat RESPONSE = R1 to R400.
compute RESPONSE = uniform(1) > 0.5.
end repeat.
compute AVG = mean(R1 to R400).
end case.
end loop.
end file.
end input program.To declare a dataset using external files read in parallel, i.e. variable X is read from X.txt and variable Y is read from Y.txt, try:
input program. data list notable file='X.txt' /X 1-10. data list notable file='Y.txt' /Y 1-10. end input program.
The INPUT PROGRAM command will stop reading all files when the shortest file ends.
To declare a dataset using external files read in sequence, i.e. concatenate the files, try:
input program.
numeric #a #b.
do if #a.
data list notable end=#b file='b.txt' /X 1-10.
do if #b.
end file.
else.
end case.
end if.
else.
data list notable end=#a file='a.txt' /X 1-10.
do if not #a.
end case.
end if.
end if.
end input program.
