Date: Fri, 7 Nov 2008 10:06:25 -0500
Reply-To: joey m <sasuser.joey.m@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: joey m <sasuser.joey.m@GMAIL.COM>
Subject: how-to-do question
Content-Type: text/plain; charset=ISO-8859-1
Hi:
I would like to make a Shapiro-Wilk test and then, if significant, make a
transfrmation on my data. But, if Shapiro is not significant I would like to
make a homogeneity of variance test.
I can do that easyly in an interactive mode, but how can I do it in a batch
mode?
I would like to figure out a way SAS can take the probability of Shapiro-W
(out of the proc univariate output) and decide whether to go to my code to
make the transformation or go to my code for homogeneity of var.
Thanks a lot.
PS. I added the code I am playing with.
*
data* raw;
input Group A B Y @@;
datalines;
1 1 1 86 1 1 2 41
1 2 1 50 1 2 2 56
1 3 1 39 1 3 2 35
2 1 1 30 2 1 2 25
2 2 1 36 2 2 2 28
2 3 1 33 2 3 2 30
3 1 1 32 3 1 2 24
3 2 1 31 3 2 2 27
3 3 1 15 3 3 2 19
4 1 1 30 4 1 2 45
4 2 1 35 4 2 2 30
4 3 1 17 4 3 2 18
;
/* RUN ANOVA ON RAW DATA & SAVE RESIDUALS */
*
proc* *mixed* data=raw;
class group;
model Y = group / outpred=residuals;
*
run*;
*
proc* *univariate* data=residuals normal plot;
var RESID;
output out=normal normal=SW probn=probSW;
*
run*;
*
*
/* IF SHAPIRO IS SIGNIFICANT (i.e. le 0.001, NOT NORMAL),
MAKE SQ-ROOT TRANSFORMATION */
*
data* transf;
set raw;
newY=sqrt(abs(y));
*
run*;
/* ELSE
-IF SHAPIRO IS NOT SIGNIFICANT (i.e. gt 0.001, NORMAL),
TEST HOMOGENEITY ON RAW DATA */
*
proc* *glm* data=raw;
class GROUP;
model Y=GROUP;
means GROUP /hovtest;
*
run*;