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
inquire data problems: gen weekI have a large data set which contains from Oct 2002 to Feb 2007. The procedure is: From Oct 19, 200…
Herfindahl-Hirschman IndexHello all, I am working on a panel data of 200 firms from 1995-2019. Data is for a single industry. …
Replacing column values with values of another variable by household idHi everyone, I have 5 variables in my dataset namely, household id, wealth rank, and household ids …
Exporter_Time_FE, Importer_Time_FE and Pair_FEDear, Prof.Joao, Prof. Tom, Dr. Sergio Correia & Others Stata Users, I am an economics graduate…
Align rows based on common groupDear Statalist I have a starting dataset that looks like the following Code: * Example generated b…
Subscribe to:
Post Comments (Atom)
0 Response to Stata for loop error
Post a Comment