BookmarkSubscribeRSS Feed
BlueNose
Quartz | Level 8

Hello all,

Some time ago, I wrote a code for power analysis for t-test, based on Rick's book on Simulations with SAS, and following a bug Rick published this code instead (here in the forum - the code is incomplete, I didn't want to publish it all although Rick already did):

/********************************************************************

Effect of Sample Size on the Power of the t Test

*******************************************************************/

%let NumSamples = 1000;            /* number of samples */

data PowerSizeSim(drop=i Delta);

call streaminit(321);

Delta = 3;                       /* true difference between means */

do N =  5, 7, 8, 10, 12, 15, 20;/* sample size                   */

   do SampleID = 1 to &NumSamples;

      do i = 1 to N;

         c = 1; x1 = rand("Normal", 0, 2);     output;

         c = 2; x1 = rand("Normal", Delta, 2); output;

      end;

   end;

end;

run;

/* 2. Compute statistics */

%ODSOff

proc ttest data=PowerSizeSim;

   by N SampleID;

   class c;

   var x1;

   ods output ttests=TTests(where=(method="Pooled"));

run;

%ODSOn 

/* 3. Construct indicator var for obs that reject H0 */

data ResultsSize;

set TTests;

RejectH0 = (Probt <= 0.05);

run;

proc freq data=ResultsSize noprint;

   by N;

   tables RejectH0 / out=SimPower(where=(RejectH0=1));

run;

Now I want to make a change, and I am not sure how to.

Instead of t-test, I want multiple tests. For example, the classic case: Clinical trial with 2 doses and a placebo, i.e., 2 comparisons (T1 vs. P and T2 vs. P). I want to use PROC MULTTEST with the Hochberg adjustment for the p values, and I define success to be when at least one dose is significantly different than the placebo (more precisely the outcome variable X is different) . For simplicity we can assume equal variances. How would you change the syntax to to that ?

I think (not sure) that the inner procedure I need is:

ods output pValues = PV;

proc MULTTEST data = testdata hochberg pvals;

  class Group;

  test mean(X);

  contrast 'T1 vs. P' -1 1 0;

  contrast 'T2 vs. P' -1 0 1;

run;

It already creates a dataset with p values. So I need an assistant just in integrating it all.

Thank you in advance !

1 REPLY 1
Rick_SAS
SAS Super FREQ

Well, you should include the BY statement:

BY N SampleID;

From your post, it sounds like you know how to simulate the data and your question is just "How do I use PROC MULTTEST?"

If that assumption is correct, I'll let others who are more familiar with PROC MULTTEST answer your question.  It doesn't sound like this question is connected to SAS/IML, so if you don't get a quick response, you might want to post this question to the SAS Statistcs Support Community: https://communities.sas.com/community/support-communities/sas_statistical_procedures

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 919 views
  • 0 likes
  • 2 in conversation