Hello,
I'm using STATA 11 and am trying to run the following code:
It runs the first loop but returns an error as soon as the second loop starts.
With a rc of 198.
If the same style of looping is used but with just display commands on the inside it runs fine.:
I don't understand why it gives an error for one but not the other.
The purpose of these loops are to run a program (industry_recode) in order to properly weight the commands to be executed by -statsby-. The reason it needs to be broken into two loops is that
there is a break where industry_recode does not have an industry code for 68.
Thank you in advance for any light that can be shed on this problem.
I'm using STATA 11 and am trying to run the following code:
Code:
forvalues i = 1(1)67 { industry_recode `i' statsby num_emp=r(N), by(educ_attain age_cohorts sex classwkr) nodots saving/* */("filepath\counts`i'.dta")/* */ :summarize if empstat == 1 & DJAinds==`i' [weight=perwt2] } forvalues i = 69(1)88 { industry_recode `i' statsby num_emp=r(N), by( educ_attain age_cohorts sex classwkr) nodots saving/* */("filepath\counts`i'.dta")/* */ :summarize if empstat == 1 & DJAinds==`i'[weight=perwt2] }
Code:
69 invalid name
If the same style of looping is used but with just display commands on the inside it runs fine.:
Code:
forvalues i = 1(1)67 { di `i' } forvalues i = 69(1)88 { di `i' }
The purpose of these loops are to run a program (industry_recode) in order to properly weight the commands to be executed by -statsby-. The reason it needs to be broken into two loops is that
there is a break where industry_recode does not have an industry code for 68.
Thank you in advance for any light that can be shed on this problem.
Comment