Hi,
I have I applied a regression loop to 1000 metabolites (outcome), and the exposure variable is BMI. I also have other variables in the model. I would like to know how I can extract only the coefficient, p-value, and 95% CI for BMI only and when BMI is significant. And then I want to extract them into an Excel file.
This is the code I have used. Finally, it informed me that there were, for example, 100 significant results. So I'm trying to figure out which 100 are those and extract them for BMI only, without other variables in the model.
I have I applied a regression loop to 1000 metabolites (outcome), and the exposure variable is BMI. I also have other variables in the model. I would like to know how I can extract only the coefficient, p-value, and 95% CI for BMI only and when BMI is significant. And then I want to extract them into an Excel file.
This is the code I have used. Finally, it informed me that there were, for example, 100 significant results. So I'm trying to figure out which 100 are those and extract them for BMI only, without other variables in the model.
PHP Code:
local counter = 0
local counter_pos = 0
local counter_neg = 0
foreach outcome of varlist B - Z {
regress `outcome' bmi Age i.sex i.smoking i.lpa2c i.cholestrol
matrix M = r(table)
if M[4, 1] < 0.05 {
local ++counter
if _b[bmi] < 0 {
local ++counter_neg
}
else {
local ++counter_pos
}
}
}
display as text "Number of positive significant: " as result `counter_pos'
display as text "Number of negative significant: " as result `counter_neg'
display as text "Total of significant results: " as result `counter'
Comment