I get an r(101) error while running the following code (the error is "factor variables and time-series operators not allowed
r(101)) and the code seems to end at "save "$scrap/area_`time'.dta", replace", since I get a "file $scrap/area_`time'.dta, saved" line right before the error line.
This error must be coming from the loop, as when I run the code by hand, directly writing "pre" instead of looping, the code seems to work, but I do not understand why that would be the case.
Would you have any insight ? Many thnka !
foreach time in pre post {
use "$scrap/temp_delim_`time'.dta", clear
merge m:1 census_code_2001 using "$scrap/temp_shrugid", keep(match) nogen
*Aggregating area data at shrid level
preserve
keep shrid state_number_2001 census_code_2001 area_std_`time'
duplicates drop
drop census_code_2001
collapse (sum) area_std_`time' , by(shrid state_number_2001)
save "$scrap/area_`time'.dta", replace
restore
collapse (sum) area_intersect_`time', by(shrid state_number_2001 ac_unique_`time' ac_no_`time')
}
use "$scrap/temp_delim_`time'.dta", clear
merge m:1 census_code_2001 using "$scrap/temp_shrugid", keep(match) nogen
*Aggregating area data at shrid level
preserve
keep shrid state_number_2001 census_code_2001 area_std_`time'
duplicates drop
drop census_code_2001
collapse (sum) area_std_`time' , by(shrid state_number_2001)
save "$scrap/area_`time'.dta", replace
restore
collapse (sum) area_intersect_`time', by(shrid state_number_2001 ac_unique_`time' ac_no_`time')
}
0 Response to question about a r(101) error
Post a Comment