I'm trying to modify the code posted by @Nick Cox in my previous question but I have some issues.
I have set my varlist
and my group variable. I have also changed the col
option to fit my varname
. I would like to add the number of observations for each group r(N 1)
/ r(N 2)
and put over the results list some "titles".
I am trying to study the display
command but I cannot figure out a solution.
My code is the following:
foreach v of var BVCAlogMAR AvgSSI L1DensityWholeImage {
quietly ranksum `v', by(G6PDcarente) porder
scalar pval = 2*normprob(-abs(r(z)))
di "`v'{col 34}" %05.3f pval " " %6.4e pval " " %05.3f r(porder) ///
" " %05.3f r(N 1) " " %05.3f r(N 2)
}
I am not able to put in the results list the values of r(N 1)
and r(N 2)
. Moreover, I have no idea how to show a column header with the following title:
P-Value, PValue2, Porder- Observ. group 1 - Observ. group 2
Can you please help me?