I am totally a beginner at Stata.
I would like to drop certain variables before further analyses and am trying to find ways to list up the dropped variables and send them to Excel.
I managed to list up the dropped variables as follows, but could anyone suggest the way to send these results (name, rho, and p-value of the dropped variables) to Excel?
Code:
*drop prot* varibles if prot* significantly correlates with age and list up the dropped variables
frame create results str32 vble long float(rho p)
foreach var of varlist prot* {
quietly spearman age `var'
if r(p) < 0.05 frame post results ("`var'") (`r(rho)') (`r(p)')
if r(p) < 0.05 drop `var'
}
frame results {
format rho p %4.3f
list, noobs clean
}
No comments:
Post a Comment