Hi,
First of all, I tried the suggestions written here, but it didn't work for me. https://www.stata.com/support/faqs/p...-local-macros/
Whenever I want to use local variables, stat does not see the lines and gives synthax error. I also tried using only the command line, but unfortunately the result did not change.
I have 500 lines of code but it does not see the macro parts. Here is a section of the code I want to execute and the error I received.
When I ran this gave me the error below:
There's a quite few local macro in my code so I really need to solve this problem. Any help wpuld be appriciated.
First of all, I tried the suggestions written here, but it didn't work for me. https://www.stata.com/support/faqs/p...-local-macros/
Whenever I want to use local variables, stat does not see the lines and gives synthax error. I also tried using only the command line, but unfortunately the result did not change.
I have 500 lines of code but it does not see the macro parts. Here is a section of the code I want to execute and the error I received.
HTML Code:
global origdatadir $origdaradir1
global dodir $dodir1
global dodirsup $dodirsup1
global dodirsup2 $dodirsup2
global dodirout $dodirout1
global igmdodir $igmdodir1
global outdatadir $outdatadir1
global logdir $logdir1
global graphdir $graphdir1
global graphdirwmf $graphdirwmf1
global graphdirpdf $graphdirpdf1
global texdir $texdir1
cd $rootdir
set more off
global countryselect $countryselect
global yearselect $yearselect
global yearcompare $yearcompare
di "`countryselect'"
global years 2006 2007 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019// TR
global indepvars $indepvars
local agemin $agemin
local agemax $agemax
local ageminlow = `agemin' - 1
gen sex = fk090
cap label var sex "Gender"
cap label val sex fk090
label define sex 1 "Male" 2 "Female"
label val sex sex
gen sex1 = sex == 1
label var sex1 "Male"
gen sex2 = sex == 2
label var sex2 "Female"
gen age = fk070 // age used for health questionnaire
gen age2 = age^2
cap label var age "Age"
if `agemax' < 80 {
local agemaxhigh = `agemax' + 1
local agemax80 "(`agemaxhigh'/max = .)"
}
Code:
. if `agemax' < 80 {
<80 invalid name
r(198);
end of do-file
r(198);
.

Comment