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
Eliminating leading blanks from a stringHi all, It seems there are leading blanks for a string variable state in 2 out of 5 rounds of data …
De-trending Panel DataHi everyone, I need help with detrending panel data. I have a panel of firm observations across year…
HELP! xtline producing different graphs each runPlease help! I have a simple, balanced longitudinal data set. I xtset the data and then run xtline.…
Interpreting Interaction Term CoefficientsDear Stata Users, I intend to study the relationship between ethnicity and COVID-19 on income. I c…
Spilt variable and fill in numeric terms in the stringDear Statalist, I have a variable called Name which looks like below. I would like to spilt Name in…
Subscribe to:
Post Comments (Atom)
0 Response to Versioning problem
Post a Comment