Hi,
I am trying to run the below loop in stata. But i get an error.
Can someone help me. I am a beginner in using Stata.
The variables fyear, B031, B031_av are already defined and available in the dateset.
forvalues fyear = 2005 / 2022 {
2. local count=0
3. foreach l of local levels {
4.
. count=count+1
5.
. local B031_sum=sum(B031) if loc == 'l'
6. B031_av = B031_sum/count
7. }
8.
. }
=exp not allowed
Many thanks in advance.
0 Response to Stata for loop error
Post a Comment