I am using STATA 17 and want to run the following code
I ran into an error `local not found`
Not sure what went wrong, I went through the post "levels of loop within a loop" by Peggy Fan in 2014. It doesn't seem to be working
Appreciate any help and suggestions! Thank you
Code:
* for each block
forvalues b = 1/`nblock' {
levelsof choice_set if block == `b', local(choice_sets)
* for each choice set
foreach c_set in local choice_sets {
display `c_set'
}
}
I ran into an error `local not found`
Not sure what went wrong, I went through the post "levels of loop within a loop" by Peggy Fan in 2014. It doesn't seem to be working
Appreciate any help and suggestions! Thank you

Comment