Code:
forval
Here is how data for one of the groups look like:
group | id | a1 | teamsize | last_i | sigma_SiSj_2 | |
x | 252 | 5 | 7 | 2 | 4200 | calculated as := (5-40)^2 + (5-1)^2 + (5-2)^2 + (5-2) + (5-59)^2 + (5-10)^2 |
x | 11 | 40 | 7 | 2 | 6895 | |
x | 231 | 1 | 7 | 2 | 4984 | |
x | 601 | 2 | 7 | 2 | 4767 | |
x | 242 | 2 | 7 | 2 | 4767 | |
x | 615 | 59 | 7 | 2 | 15540 | |
x | 14 | 10 | 7 | 2 | 3535 |
Code:
forval
Here is the code I run (max teamsize is 64)
Code:
forval i = 1/64{ if `i' <= teamsize{ by group: replace sigma_SiSj_2 = sigma_SiSj_2 + (a1 - a1[`i'])^2 replace last_i=`i' } */ IF } */ FORVAL i = 1/64
What/where is my error?
Thank you in advance,
C.
0 Response to multiple rows loop
Post a Comment