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
Crude incidence rate straitfied by calendar yearI have estimated the overall crude incidence rate of diabetes in people with hypertension (the study…
Truncating numerical dates to yearsI am trying to merge a few datasets, and one of them uses very specific date information in a format…
Help selecting font with collect style putdocxHi, I am trying to export a collection to an MS Word document where the entire table uses the "Time…
ologitgof - Package ?Hi everyone! I need to run goodness-of-fit tests post-ordinal regression models, but can't find any…
Large panel model: counting time periods since variable ==1Hi I have a very large panel dataset (50 time periods, 30m panel IDs) and I have a variable (called…
Subscribe to:
Post Comments (Atom)
0 Response to Stata for loop error
Post a Comment