Saturday, March 30, 2019

making loop with the values within the variable

Hello,

I have one of the variables G1 which has values from 1 to 17.
Then I want to make a loop as below,but it didn't work out.
Anyone can help what is the problem? thanks in advance.

foreach i in G1 {
sum sw20h if G1==`i'
global Ng`i'=r(sum)
}

No comments:

Post a Comment