Macro for ANOM with Unequal Sample Sizes

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: ANOMH2                                              */
 /*   TITLE: Macro for ANOM with Unequal Sample Sizes            */
 /* PRODUCT: QC                                                  */
 /*  SYSTEM: ALL                                                 */
 /*   PROCS:                                                     */
 /*    DATA:                                                     */
 /*    KEYS: ANOM, Analyis of Means,                             */
 /*                                                              */
 /*     REF: L.S. Nelson (1983), 'Exact Critical Values for      */
 /*          Use with the Analysis of Means'. Journal of Quality */
 /*          Technology 15, pp. 40-44.                           */
 /*                                                              */
 /*          D.O. Fulenwider (1988), 'Using SAS Software for     */
 /*          Analysis of Means', "SAS Users Group International: */
 /*          Proceedings of the Thirteenth Annual Conference,    */
 /*          1212-1219.                                          */
 /*                                                              */
 /*   NOTES: Macro for providing upper bounds on the true        */
 /*          value of the critical value necessary for the       */
 /*          analysis of means technique                         */
 /*                                                              */
 /*          This macro is designed to provide upper bounds on   */
 /*          the critical values needed for use with the         */
 /*          analysis of means technique.  The values should be  */
 /*          used for the analysis of means with unequal sample  */
 /*          sizes and also for treatment effects such as        */
 /*          interactions (unequal correlation structure).       */
 /*          The values generated are calculated as the upper    */
 /*          'alpha*'/2 percentage points of a student's t       */
 /*          distribution, where                                 */
 /*             'alpha*'/2 = 1-(1-alpha)**(1/k)                  */
 /*             alpha      = the desired significance level      */
 /*             k          = the number of means.                */
 /*          It should also be used to provide halpha values     */
 /*          where the number of degrees of freedom for error    */
 /*          is less than k.  The arguments of the function are  */
 /*          the same for the balanced case. (See the sample     */
 /*          member, anomh)                                      */
 /*                                                              */
 /****************************************************************/

 %macro anomh2(alpha,df,k);

 data _null_;

 astar = 1 - (1-&alpha)**(1/&k);

 /* Since astar corresponds to a two-sided significance level,   */
 /* the one-sided level would be astar/2                         */

 astar = astar/2;

 /* Compute the probability value necessary for the tinv function */

 prob = 1 - astar;
 halpha = tinv(prob,&df);
 call symput('halpha',left(put(halpha,8.3)));

 %mend anomh2;