Hi,

I have somewhat of a basic question. I am running the lasso linear command and wanted to use that to extract the selected variables and then use them for another estimation.

From what I can tell, I am interested in extracting e(post_sel_vars). However, since I am an R user, I don't know how to extract the vector of variables selected (please note that I am not interested in the coefficients but rather the variable names).

This is what I have right now (the parts highlighted in bold are wrong):

foreach var in $outcome_vars {

lasso linear `var' (i.report_month i.report_year i.tehsil_level i.ao) $ability_vars $network_vars $agsmart_indicators $interactions , selection(adaptive) cluster(end_tehsil) noconstant
//ereturn list

local selected_vars = e(post_sel_vars)
//lassocoef lassoadaptive, display(coef, standardized)


xtreg `var' subplus `selected_vars', i(ao) nonest fe
}

Any help would be greatly appreciated!

Thanks,
Bhavya