Programming the statistical procedures from SAS

paired t-test macro

Reply
New Contributor
Posts: 4

paired t-test macro

Dear all,

 

I need some help with a macro procedure for paired t-tests in a sample of stocks independently sorted across two variables (please see the top of the attached text file). There are 25 groups that have been formed out of the intersections of the variable rankings (each variable has 5 distinct groups). The means within these groups are of variable DEX. I would like to be able to test the paired t-test for the groups at the outskirts of the rankings; for example the intersection of BM_RK "1" and DEX_RK "1" against the intersection of BM_RK "5" and DEX_RK "1". Following that pattern there would be five test results on the right hand side of the transposed table (see bottom portion of the attached text file) and five test results at the bottom of the table.

 

I have been able to form individual data sets from the sample to capture the needed intersections of the ranked variables but the effort is not very efficient and I believe that there might be a better technique that I am currently not familiar with.

 

Thank you for help.

Super User
Posts: 18,572

Re: paired t-test macro

I think that's just an ANOVA? 

See the examples of multiple comparison. Make sure to adjust for multiple tests. 

 

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_anova_sect0...

Respected Advisor
Posts: 4,754

Re: paired t-test macro

[ Edited ]

You could build on:

 

proc sort data=myData; 
by dex_rk bm_rk; 
run;

proc ttest data=myData(where=(bm_rk in (1, 5)));
by dex_rk;
class bm_rk;
var dex;
run;

Note: that's not what is called a "paired t-test". 

PG
Ask a Question
Discussion stats
  • 2 replies
  • 256 views
  • 0 likes
  • 3 in conversation