Help using Base SAS procedures

how to create a matrix of p-values? proc ttest? something else?

Reply
Contributor ivs
Contributor
Posts: 26

how to create a matrix of p-values? proc ttest? something else?

hi all,

i am working on a project that requires to find similarity in measured performance. using  proc ttest works great for the purpose. is there a way to output a matrix of p-values? here is an example of data:

data one;

input a b c d e;

cards;

12 25 41 15 68

25 11 42 56 3

85 24 45 91 97

2 75 98 64 83

84 55 2 87 92

53 67 82 19 17

54 89 13 26 9

28 11 75 61 69

38 49 23 31 33

5 84 37 41 20

;

proc ttest data=one sides=2;

paired (a b c d e)*(a b c d e);

run;

what i want as output is a matrix of p-values (here i put it together manually):

     a       b      c       d      e

a   1.00   0.47  0.67  0.29  0.43

b   0.47  1.00   0.82  0.99  0.99

c   0.67   0.82  1.00  0.80  0.81

d   0.29   0.99   0.80  1.00 1.00

e   1.00   0.99   0.81  1.00  1.00

does anyone know how to output such matrix?

if there is a way to calculate it by a procedure other than ttest, that's fine. 

many thanks in advance for your help!

Super User
Posts: 19,855

Re: how to create a matrix of p-values? proc ttest? something else?

Two extra lines can get you closer, I'll assume you can transpose it to the shape required if you really want using proc transpose Smiley Happy

ods select ttests;

ods table ttests=summary1;

proc ttest data=one sides=2;

paired (a b c d e)*(a b c d e);

run;

Contributor ivs
Contributor
Posts: 26

Re: how to create a matrix of p-values? proc ttest? something else?

thanks Reeza. this does get me closer Smiley Happy

Ask a Question
Discussion stats
  • 2 replies
  • 235 views
  • 3 likes
  • 2 in conversation