Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iterations in spss

835 views
Skip to first unread message

d_f...@hotmail.com

unread,
Feb 27, 2008, 7:15:44 AM2/27/08
to
i want to generate 10000 data set of size 1000 in spss.but when
running the syntax no data generated and appears

the Warning # 232
>The limit on the number of iterations in an iterative DO loop has been
>exceeded. To increase the limit, use SET MITERATE. To check the limit use
>the SHOW command.

i tried to use the statment
set miterate=1000000. but another error that the parameter should be
positive???????!!!!!!!
if any one know the solution to this problem, please send me as soon
as possible.

my syntax was:
*** The following syntax was used to generate the 10000 data files
***
!SampGen .
DEFINE !SampGen (nbsamp=!DEFAULT (3) !TOKENS (1)
/path=!DEFAULT ('D:\Doaa\work\') !
TOKENS (1) )
* Begin loop for creating multiple random samples .
!DO !cnt=1 !TO 10000 .
input program.
loop #i = 1 to 1000 .
do repeat response=r1 to r5.
compute response = normal(1) .
end repeat.
end case.
end loop.
end file.
end input program.
correlations r1 to r5 / statistics=descriptives.
* Factor procedure computes pr1 to pr5, which are standard .
factor variables = r1 to r5 / print = default det /criteria =
factors(5) /save=reg (all,pr).
correlations pr1 to pr5 / statistics=descriptives.
* use matrix to set corr matrix.
* x is a 10,000 by 5 matrix of independent standard normals .
* cor is the target covariance matrix.
* cho is the Cholesky factor of cor .
* newx is the 10,000 by 5 data matrix which has target covariance
matrix .
matrix.
get x / variables=pr1 to pr5.
compute cor={1, 0.4, 0.3, 0.2, 0.1 ; 0.4, 1, 0.4, 0.3, 0.2 ; 0.3, 0.4,
1, 0.4, 0.3 ; 0.2, 0.3, 0.4, 1, 0.4 ; 0.1, 0.2, 0.3, 0.4, 1 }.
compute deter=det(cor).
print deter / title "determinant of corr matrix" / format=f10.7 .
print sval(cor) / title "singular value decomposition of corr".
print eval(cor) / title "eigenvalues of input corr".
* In a symmetric matrix sval and eigenvalues are identical - choose
1 .
compute condnum=mmax(sval(cor))/mmin(sval(cor)).
print condnum / title "condition number of corr matrix" /
format=f10.2 .
compute cho=chol(cor).
print cho / title "cholesky factor of corr matrix" .
compute chochek=t(cho)*cho.
print chochek / title "chol factor premult by its transpose " /
format=f10.2 .
compute newx=x*cho.
compute mu={15, 1, 0, 0, 0}.
compute one=MAKE(1,1000,1).
compute newx=newx+ t(one)*mu.
save newx /outfile=* /variables= nr1 to nr5.
end matrix.
correlations nr1 to nr5 / statistics=descriptives.
DO IF (nr1 < 14) .
COMPUTE w2 = nr2.
END IF .
DO IF (nr1 < 15) .
COMPUTE w3 = nr3.
END IF .
DO IF (nr1 < 15.5) .
COMPUTE w4 = nr4.
END IF .
DO IF (nr1 < 16) .
COMPUTE w5 = nr5.
END IF .
SAVE OUTFILE=!QUOTE(!CONCAT(!path,!cnt,'.sav')) .
SAVE TRANSLATE OUTFILE=!QUOTE(!CONCAT(!path, 's', !cnt,'.sd7')) .
WRITE OUTFILE=!QUOTE(!CONCAT(!path,!cnt,'.dat'))
TABLE /ALL.
EXECUTE.
!DOEND
!ENDDEFINE .

Bruce Weaver

unread,
Feb 27, 2008, 8:34:30 AM2/27/08
to
On Feb 27, 7:15 am, d_f...@hotmail.com wrote:
> i want to generate 10000 data set of size 1000 in spss.but when
> running the syntax no data generated and appears
>
> the Warning # 232
>
> >The limit on the number of iterations in an iterative DO loop has been
> >exceeded. To increase the limit, use SET MITERATE. To check the limit use
> >the SHOW command.
>
> i tried to use the statment
> set miterate=1000000. but another error that the parameter should be
> positive???????!!!!!!!
> if any one know the solution to this problem, please send me as soon
> as possible.

--- snip ---

In version 16 (running under Windoze XP Professional, SP2), I am not
getting any error messages when I run the following.

set miterate=1000000.
show miterate.

I'm not sure why you need to set MITERATE to 1000000, though. Your
loops are nested, so isn't 10000 all you need?

--
Bruce Weaver
bwe...@lakeheadu.ca
www.angelfire.com/wv/bwhomedir
"When all else fails, RTFM."

JKPeck

unread,
Feb 27, 2008, 11:10:44 AM2/27/08
to
> bwea...@lakeheadu.cawww.angelfire.com/wv/bwhomedir

> "When all else fails, RTFM."

First, the relevant control depends on the kind of loop. MITERATE is
for macro iterations, and MXLOOPS is for, well, loops.

Second, if your loop has an explicit limit, MXLOOPS does not apply.
If it is unbounded or uses only a conditional statement, MXLOOPS will
limit the number of repetitions of the loop. This is done in order to
prevent infinite loops. The MXLOOPS value defaults to 40, but you can
use SET MXLOOPS to change this value. MITERATE defaults to 1000 and
can similarly be changed by SET MITERATE.

Prior to SPSS 16, I think, a loop terminated by MXLOOPS ended
silently. In SPSS 16, you get a warning message in this condition.

HTH,
Jon Peck

Bruce Weaver

unread,
Feb 27, 2008, 1:51:40 PM2/27/08
to
On Feb 27, 11:10 am, JKPeck <JKP...@gmail.com> wrote:

> First, the relevant control depends on the kind of loop. MITERATE is
> for macro iterations, and MXLOOPS is for, well, loops.

Good point! ;-)

0 new messages