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.
Related Posts with Stata for loop error
how to export Summary Statistics to wordDear Sir/Madam I am working on my thesis on impact of informal credit on household welfare. I try to…
Adding partner data to responding person data in a panel data fileI wish to extend my analysis of panel data to include information about the responding person's part…
Generate a new variable in a loop in different files and calculating the meanHi, I want to write a loop to generate a new variable called savings (income-expenditure) in two se…
Numbering occurrences of a flag within patients.In the example below I have created OVERLAP_FLAG, which is equal to 1 where two consecutive regimens…
Marginal effect after heckpoissonDear All, I am new to stata and I am using Heckpoisson, a poison regression model with endogenous s…
Subscribe to:
Post Comments (Atom)
0 Response to Stata for loop error
Post a Comment