Hello everybody,
I have a problem creating a summary table of statistical tests by gender, since I have several variables and I want put them all in a one table, for that, I'm using a global variable:
global variables v1 v2 v3 v4 ... vn
and:
foreach var of global variables {
table (command) (result), ///
command(Male = r(mu_1) N1 = r(N_1) Female = r(mu_2) N2 = r(N_2) Diff = (r(mu_1)-r(mu_2)) p-value = r(p): ttest `var', by(sex)) ///
nformat(%6.4f Male Female Diff p-value)
collect label list command, all
}
So, when i run the code, the result is a table for each variable in "variables", but want all the variables in a single table. Manually, the code comes out the way I want, but I want to work skillfully.
Thanks.
I have a problem creating a summary table of statistical tests by gender, since I have several variables and I want put them all in a one table, for that, I'm using a global variable:
global variables v1 v2 v3 v4 ... vn
and:
foreach var of global variables {
table (command) (result), ///
command(Male = r(mu_1) N1 = r(N_1) Female = r(mu_2) N2 = r(N_2) Diff = (r(mu_1)-r(mu_2)) p-value = r(p): ttest `var', by(sex)) ///
nformat(%6.4f Male Female Diff p-value)
collect label list command, all
}
So, when i run the code, the result is a table for each variable in "variables", but want all the variables in a single table. Manually, the code comes out the way I want, but I want to work skillfully.
Thanks.
Comment