You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
Nothing to do with looping. The problem is likely to be in combining global and local macros in the wrong way. You don't give any examples or explain what you mean by "doesn't work", but my guess is that you need
Code:
forval i = 1/17 {
global Pi2016_`i' = ${Ng_`i'} / $Ngt
}
Other comments.
0. You are trying to program in Stata but seemingly haven't read the basic sections on macros in [U].
1. forval is cleaner and faster than foreach here.
2. Much better to use variables. I will post more comments in your other thread, namely .
Comment