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
Merging two variables + timeDear Statalist users I have some activity data which asks respondents how much time they spent in p…
How to use append in esttabHi everyone I am using the following dataset and creating 2 tables Code: * Example generated by -da…
while loop error, testing overdispersionHello everyone, i have an issue with a loop. I got this from Hilbe's book "modeling count data". I'm…
Need some helpIm working with a "Encuesta Permanente de Hogares" (EPH) can someone help me with something? …
Two-side bar chart over groups hello everyone, I've created the following graph in excel and I'd like to do it with Stata, howeve…
Subscribe to:
Post Comments (Atom)
0 Response to Versioning problem
Post a Comment