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 simulate data with specified ROC AUC and specified odds ratioI would like to do the following: 1- simulate 1000 observations 2 - simulate a continuous biomarker …
Testing measurement invariance across two groups/endless iterations when fitting the modelI am trying to test measurement invariance for a scale with 20 items loading 4 latent variables (no …
Creating bar chart with multiple binary variablesHi, I am attempting to create a bar chart in Stata that shows proportions for multiple different bin…
Analysing which colour contributes to the greatest price premiumHi Everyone, I hope you're well! I am trying to observe what colours have the greatest price premi…
Counting number of individuals (by sex and age) that answer a question in a longitudinal studyHello, I have a dataset with information of abuse (variable name: abused) at work by age and sex (v…
Subscribe to:
Post Comments (Atom)
0 Response to Stata for loop error
Post a Comment