Hello,
I am writing an command to conduct univariate logistic regression for some 1000+ variables using the below code.
foreach var of varlist V1-V1000{
logistic outcome `var'
}
This command gives me what I want, it regresses the outcome with each variable V1, V2, V3 etc separately. Now, I would like to export cleaner versions of the output to an excel sheet or word document. I write the following code for the word document;
putdocx begin
putdocx paragraph
putdocx text ("Binary Outcome")
foreach var of varlist V1 - V1000{
logistic outcome `var'
}
putdocx table TABLE1=etable
putdocx save Example1
The command above does not give me what I want, I only get the last tables for variable V1000.
I also tried the excel output with the following code, I would like to collect the following, Variable, odds ratio, 95% CI and p-value, I would like it to look like this;
Variable OR 95% CI. P
A 1.2. 1.1 - 1.5. 0.002
B 0.99 0.97 - 1.1. 0.23
C 1.5 1.3 - 2.2 0.001
D 0.12 0.09 - 0.11 0.03
I typed the following;
/*WRITE TO columns*/
putexcel A1 = ("Variable") using data..xlsx, replace
matrix b = e(b)’
putexcel A2 = matrix(b), rownames nformat(number_d2)
putexcel B1 = "OR"
putexcel C1 = "95% Conf. Interval"
putexcel D1 = "P>|z|"
putexcel save
But I am getting some of the variable names in rows instead of columns and my data isn't showing up. Thank you in advance for your help.
I am writing an command to conduct univariate logistic regression for some 1000+ variables using the below code.
foreach var of varlist V1-V1000{
logistic outcome `var'
}
This command gives me what I want, it regresses the outcome with each variable V1, V2, V3 etc separately. Now, I would like to export cleaner versions of the output to an excel sheet or word document. I write the following code for the word document;
putdocx begin
putdocx paragraph
putdocx text ("Binary Outcome")
foreach var of varlist V1 - V1000{
logistic outcome `var'
}
putdocx table TABLE1=etable
putdocx save Example1
The command above does not give me what I want, I only get the last tables for variable V1000.
I also tried the excel output with the following code, I would like to collect the following, Variable, odds ratio, 95% CI and p-value, I would like it to look like this;
Variable OR 95% CI. P
A 1.2. 1.1 - 1.5. 0.002
B 0.99 0.97 - 1.1. 0.23
C 1.5 1.3 - 2.2 0.001
D 0.12 0.09 - 0.11 0.03
I typed the following;
/*WRITE TO columns*/
putexcel A1 = ("Variable") using data..xlsx, replace
matrix b = e(b)’
putexcel A2 = matrix(b), rownames nformat(number_d2)
putexcel B1 = "OR"
putexcel C1 = "95% Conf. Interval"
putexcel D1 = "P>|z|"
putexcel save
But I am getting some of the variable names in rows instead of columns and my data isn't showing up. Thank you in advance for your help.
Comment