Hello All,
I have a long list of variables that all need to be defined in the same way.
I wrote the following which simply returns the error "invalid syntax".
The code works when I run with the lab val but without the lab def, suggesting a problem with the label define portion.
Advice please!
local varname "esttype_br_rural esttype_br_total esttype_br_urban [..rest of varnames.]"
local a=wordcount("`varname'")
forval i=1/`a'{
local name=word("`varname'", `i')
lab val `varname' `varname'_lab
lab def `varname'_lab ///
1 "Annual estimate" ///
3 "Three year moving average" ///
5 "Five year estimate" ///
10 "Ten year census"
}
I have a long list of variables that all need to be defined in the same way.
I wrote the following which simply returns the error "invalid syntax".
The code works when I run with the lab val but without the lab def, suggesting a problem with the label define portion.
Advice please!
local varname "esttype_br_rural esttype_br_total esttype_br_urban [..rest of varnames.]"
local a=wordcount("`varname'")
forval i=1/`a'{
local name=word("`varname'", `i')
lab val `varname' `varname'_lab
lab def `varname'_lab ///
1 "Annual estimate" ///
3 "Three year moving average" ///
5 "Five year estimate" ///
10 "Ten year census"
}
Comment