Hi. I'm submitting this for one of our programmers and wondering if there's a simple fix or if we need to open a ticket with Stata. Thanks.
We’re having issues running a do file in Stata 16. It was written in Stata 15 and runs great there, but in Stata 16 it does not run. The issue is a test I’m performing. I’m comparing nutrient consumption between 2016 and 2017. Putting version 15 at the top allows it to run inside Stata 16; however, unless the coding for testing has changed in Stata 16, it should run without the versioning. Please advise.
Here’s the code in case it’s helpful, with error message.
clear
set obs 1
gen str45 label=" "
save "temp1.dta",replace
capture program drop fg
program define fg
use "T:\GFRP-Chile\diet and anthropometry data\Change 2016-17\Output_Data\nutr_analysis.dta", clear
gen str45 label="`2'"
mean `1'_16 `1'_17, over(agecat)
matrix means=r(table)
gen m116=round((means[1,1]),.01)
gen m1_16=strofreal(m116)
gen m216=round((means[1,2]),.01)
gen m2_16=strofreal(m216)
gen m117=round((means[1,3]),.01)
gen m1_17=strofreal(m117)
gen m217=round((means[1,4]),.01)
gen m2_17=strofreal(m217)
gen s116=round((means[2,1]),.01)
gen s1_16=strofreal(s116)
gen s216=round((means[2,2]),.01)
gen s2_16=strofreal(s216)
gen s117=round((means[2,3]),.01)
gen s1_17=strofreal(s117)
gen s217=round((means[2,4]),.01)
gen s2_17=strofreal(s217)
test [`1'_16]1 = [`1'_17]1 //error message says equation [kcal_16] not found
replace m1_17 = m1_17+"*" if r(p)<0.05
test [`1'_16]2 = [`1'_17]2
replace m2_17 = m2_17+"*" if r(p)<0.05
keep in 1
keep label m1_16 s1_16 m1_17 s1_17 m2_16 s2_16 m2_17 s2_17
order label m1_16 s1_16 m1_17 s1_17 m2_16 s2_16 m2_17 s2_17
append using "temp1.dta"
save "temp1.dta",replace
end
fg kcal "Calories"
fg tsug "Total Sugar"
fg na "Sodium"
fg sfat "Saturated Fat"
exit
Related Posts with Versioning problem
Seemingly Unrelated Regression with endogenous variablesCan I use Seemingly Unrelated Regression for system of equations in which I have an institutions var…
How to count the number of variables in multiple locals and meanwhile to compute the mean value of each group using for loop in Stata?As the title suggested, I would like to count the number of variables in multiple locals and meanwhi…
Occupation categoization according to STEM definitionHello stata community, I believe I'm having trouble coding the occupation of IPUMS CPS dataset acco…
ivprobit - very high wald chi2 - not the expected signsDear experts, Iam a bit lost in understanding what is going wrong with my model. Here is what I 've…
Esttab not giving the right outputHello, I am trying to create a table (4 columns and 3 rows) with names of states (variable state_na…
Subscribe to:
Post Comments (Atom)
0 Response to Versioning problem
Post a Comment