Hello,
In the following examples, the MICOMBINE command recognizes my local varlist,
but the FORVALUES loop results in INVALID SYNTAX if I refer to the local macro.
Any help is much appreciated.
*****************************
local covafs
" zmale agecmof2 zblack zhispanc
zhchld1a zxxwrkft zboy
zcurremp zcar" ;
local covaboy
" zmale agecmof2 zblack zhispanc
zhchld1a zxxwrkft zboy
zcurremp zcar if zboy ==1 " ;
local covagrl
" zmale agecmof2 zblack zhispanc
zhchld1a zxxwrkft zboy
zcurremp zcar if zboy == 0" ;
* ATTEMPT TO REDEFINE COVAGRL WITHIN LOOP;
* 2 - PARENTING ONLY;
micombine reg actscaf3
efchmag3
famrotf3
posscaf3
negscaf3
acpscaf3
monscaf3
psyscaf3
e `covagrl' ,impid(_mult_) obsid(sampleid) robust cluster (sampleid) ;
forvalues j = 1/10 {;
local covagrl
" zmale agecmof2 zblack zhispanc
zhchld1a zxxwrkft zboy
zcurremp zcar if zboy == 0" ;
reg actscaf3
efchmag3
famrotf3
posscaf3
negscaf3
acpscaf3
monscaf3
psyscaf3
e
`covagrl'
, robust cluster (sampleid), if _mult_ == `j';
local r2 = e(r2);
gen obs`j' = `r2';
};
list obs1-obs10 in 1/1;
drop obs1-obs10;
*********************************
* DESIRED METHOD - REFER TO COVAGRL DEFINED ABOVE;
* 3 - YOUTH ONLY;
micombine reg actscaf3
stasclf3
pbsscaf3
extscaf3
innscaf3
frscaf3
hopscaf3
envscaf3
e `covagrl' ,impid(_mult_) obsid(sampleid) robust cluster (sampleid) ;
forvalues j = 1/10 {;
qui reg actscaf3
stasclf3
pbsscaf3
extscaf3
innscaf3
frscaf3
hopscaf3
envscaf3
e `covagrl' , robust cluster (sampleid), if _mult_ == `j';
local r2 = e(r2);
gen obs`j' = `r2';
};
list obs1-obs10 in 1/1;
drop obs1-obs10;
*************
current e-mail: [email protected]
permanent e-mail: [email protected]
*************
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/