Hello! I was not able to perform the following code and error message says that _"sm35_temp invalid name
when I use either local or scalar. Thank you for your help!
set more off
logit OwnLivestock2 m35_temp c.m35_temp#c.m35_temp m610_temp c.m610_temp#c.m610_temp m112_temp c.m112_temp#c.m112_temp ///
m35_prec c.m35_prec#c.m35_prec m610_prec c.m610_prec#c.m610_prec m112_prec c.m112_prec#c.m112_prec ///
i.fine_soil Dist_River Dist_Port Dist_Market, robust
local climate m35_temp m610_temp m112_temp m35_prec m610_prec m112_prec fine_soil Dist_River Dist_Port Dist_Market
local country Bangladesh Indonesia SriLanka Thailand VietNam
foreach co of local country {
foreach c of local climate {
qui sum `c' if country == "`co'"
local "s`c'" = r(mean)
local "s`c'2" = r(mean)^2
}
lincom sm35_temp*m35_temp + sm610_temp*m610_temp + sm112_temp*m112_temp + sm35_prec*m35_prec + sm610_prec*m610_prec + sm112_prec*m112_prec ///
+ sfine_soil*i.fine_soil + sDist_River*Dist_River + sDist_Port*Dist_Port + sDist_Market*Dist_Market
outreg2 using lincom.xls, nolabel excel dec(5) rdec(3) aster(coef) append
}
*
when I use either local or scalar. Thank you for your help!
set more off
logit OwnLivestock2 m35_temp c.m35_temp#c.m35_temp m610_temp c.m610_temp#c.m610_temp m112_temp c.m112_temp#c.m112_temp ///
m35_prec c.m35_prec#c.m35_prec m610_prec c.m610_prec#c.m610_prec m112_prec c.m112_prec#c.m112_prec ///
i.fine_soil Dist_River Dist_Port Dist_Market, robust
local climate m35_temp m610_temp m112_temp m35_prec m610_prec m112_prec fine_soil Dist_River Dist_Port Dist_Market
local country Bangladesh Indonesia SriLanka Thailand VietNam
foreach co of local country {
foreach c of local climate {
qui sum `c' if country == "`co'"
local "s`c'" = r(mean)
local "s`c'2" = r(mean)^2
}
lincom sm35_temp*m35_temp + sm610_temp*m610_temp + sm112_temp*m112_temp + sm35_prec*m35_prec + sm610_prec*m610_prec + sm112_prec*m112_prec ///
+ sfine_soil*i.fine_soil + sDist_River*Dist_River + sDist_Port*Dist_Port + sDist_Market*Dist_Market
outreg2 using lincom.xls, nolabel excel dec(5) rdec(3) aster(coef) append
}
*
Comment