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
split, parse(,) maximum number of variables reachedDear all, I'm using Stata 15 and trying to split a string variable into different component which ar…
Outreg2 providing one-sided p-valuesDear Stata users, I have a question regarding the one-sided p-value in outreg2, which I use to expo…
Create a dummy variable that equals 1 if the compensation committee is comprised wholly of independent directorsHi everyone, I am new to the stata forum and I have some questions. To run my regression, I need som…
Regression output - Bug?Hi everyone, I am trying to run some old code (version 14.2) using a new Stata version (15.1) on a …
Random dummy variable with restrictionsI have a panel dataset and want to create a random dummy variable with mean 0.2 that marks a random …
Subscribe to:
Post Comments (Atom)
0 Response to Versioning problem
Post a Comment