Dear Statalist,
Is it possible to transform the following code:
Into the simpler :
If it is, how can I define my local groups so that it contains the precise elements : ``var'_id'cat ``var'_id'num ``var'_id'catprod hhcat hhnum, without Stata referring to the content of the local macro ``var'_id' ? Thank you for your help.
Is it possible to transform the following code:
Code:
capture unab ``var'_id'cat : ``var'_id'cat_* if c(rc) == 111 { local ``var'_id'cat } capture unab ``var'_id'num : ``var'_id'num_* if c(rc) == 111 { local ``var'_id'num } capture unab ``var'_id'catprod : ``var'_id'catprod_* if c(rc) == 111 { local ``var'_id'catprod } capture unab hhcat : hhcat_* if c(rc) == 111 { local hhcat } capture unab hhnum : hhnum_* if c(rc) == 111 { local hhnum }
Code:
foreach j of local groups { capture unab `j' : `j'_* if c(rc) == 111 { local `j' } }
Comment