Hi,
I am unable to find a way to export output of ManWitney U (ranksum) Test for independent samples.

Here is how data looks (sample for few observations):
cat tot_dis
Batch 18
Batch 1
Stream 12.5
Stream 5.5
Stream 15
Batch 19
Batch 6.5
Batch 10
Stream 0
Stream 3.5
Batch 3

I am running this code:
ranksum tot_dis, by(cat)
scalar define U1=r(sum_obs)-r(N_1)*(r(N_1)+1)/2
scalar define U2=r(N_1)*r(N_2)-U1
display in smcl as text "Mann-WhitneyU="as result min(U1,U2)



This is the output:

Two-sample Wilcoxon rank-sum (Mann-Whitney) test

cat | obs rank sum expected
-------------+---------------------------------
Batch | 172 23438 22704
Stream | 91 11278 12012
-------------+---------------------------------
combined | 263 34716 34716

unadjusted variance 344344.00
adjustment for ties -588.32
----------
adjusted variance 343755.68

Ho: tot_dis(cat==Batch) = tot_dis(cat==Stream)
z = 1.252
Prob > |z| = 0.2106

. scalar define U1=r(sum_obs)-r(N_1)*(r(N_1)+1)/2

. scalar define U2=r(N_1)*r(N_2)-U1

. display in smcl as text "Mann-WhitneyU="as result min(U1,U2)
Mann-WhitneyU=7092

.
end of do-file

This is what I need help on:

How can I export value of U and p value? I have to do this for many variables and copy pasting is time consuming.


Thanks in anticipation.
Puran