[Limdep Nlogit List] help with looping

Philip A. Viton viton.1 at osu.edu
Mon Aug 24 03:01:34 EST 2009


The following is from the Limdep v. 7 manual, p. 780:

matrix;a=Init(3,3,0)$
do for;10;i=1,3$
do for;5;j=1,3$
calc;ij=i*j$
matrix;a(i,i)=ij$
enddo;5$
enddo;10$


When I run it from a new session I get:

--> RESET
Initializing NLOGIT Version 3.0.14 (August 1, 2004).
--> matrix;a=Init(3,3,0)$
--> do for;10;i=1,3$
--> do for;5;j=1,3$
--> calc;ij=i*j$
   Error   464: Error in or near I*J;
   Error   116: CALC - Unable to compute result. Check earlier message.
--> matrix;a(i,i)=ij$
   Error    67: Matrix element in an expression has an invalid subscript.
--> enddo;5$
--> enddo;10$


This is symptomatic of problems I'm having with "real" programming in 
loops - computations involving the loop indices seem to fail. Can 
someone tell me what's going wrong?

Thanks!


------------------------
Philip A. Viton
City Planning, Ohio State University
275 West Woodruff Avenue, Columbus OH 43210
viton.1 at osu.edu



More information about the Limdep mailing list