stata loop over numbers code example
Example 1: use forvalues stata
> local mcode 0
> local month jan feb mar apr
> foreach m of local month {
local mcode = `mcode' + 1
display "`mcode': `m'"
}
1: jan
2: feb
3: mar
4: apr
Example 2: use forvalues stata
* define a local macro called month
> local month jan feb mar apr
> display `"`month'"'
jan feb mar apr