Hi all,
Its Split-Split macro. It works fine for adjust=tukey but when one use adjust=t it gives some Notes in RTF file 5 times.
This was the note that gets printed. I don't want this note to be printed in RTF file.
The GLM Procedure
Least Squares Means
[pre]
Note:To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used. [/pre]
I have used ODS LISTING CLOSE/ODS LISTING but still no success. The main part to look for is before PROC IML in the code. Here is the code.
[pre]
options symbolgen mprint mlogic spool;
options nodate center notes nonumber formdlim="_";
goptions reset=all;
data split_split;
input Rep Irrigation Hydrogel Fertilizer yield;
cards;
1 1 1 1 24.0
1 1 1 2 30.0
1 1 2 1 29.5
1 1 2 2 24.0
1 2 1 1 40.2
1 2 1 2 36.1
1 2 2 1 40.4
1 2 2 2 37.8
1 3 1 1 27.3
1 3 1 2 33.4
1 3 2 1 29.6
1 3 2 2 27.6
2 1 1 1 24.0
2 1 1 2 33.0
2 1 2 1 19.5
2 1 2 2 25.0
2 2 1 1 39.2
2 2 1 2 35.1
2 2 2 1 28.4
2 2 2 2 30.8
2 3 1 1 27.3
2 3 1 2 32.4
2 3 2 1 25.6
2 3 2 2 27.6
;run;
/* Assigning values to various macro variable names */
%let ds = split_split; /* Name of the SAS dataset */
%let dep_var = yield; /* Name of the dependent variable */
%let block_var = rep; /* Give Block variable name here */
%let main_plot = Irrigation; /* Give Main Plot variable name here */
%let sub_plot = Hydrogel; /* Give Sub Plot variable name here */
%let subsub_plot = Fertilizer; /* Give Sub-Sub Plot variable name here */
%let adjust = t; /* Enter Multiple Comparison Adjustment Variable here. Accepted values are TUKEY or T */
%let rtf = D:\Split_Split plot Demo.rtf; /* Output file Name. Make sure that you have write permissions for the folder. */
%macro split_split(ds=,dep=,main=,sub=,subsub=);
ods rtf file="&rtf" style=journal bodytitle startpage=no;
ods listing close;
ods output overallanova=total_ss ModelANOVA=typeI classlevels=variables(drop=values);
ods output AltErrTests=error_sub diff=ppp FitStatistics=fitstat;
ods trace on/label;
title; footnote;
title1 h=5 'Split-Split Plot Design Analysis';
/*PROC GLM STARTS HERE*/
Proc GLM data=&ds;
class &block_var &main ⊂ ⫕
model &dep = &block_var &main &block_var*&main ⊂ &main*⊂ &block_var*&main*⊂ &subsub &main*&subsub ⊂*&subsub &main*⊂*&subsub/ss3;
test h=&block_var &main e=&block_var*&main;
test h=⊂ &main*⊂ e=&block_var*&main*⊂
lsmeans &main /pdiff e=&block_var*&main adjust=&adjust ;
lsmeans ⊂ &main*⊂/pdiff e=&block_var*&main*⊂ adjust=&adjust ;
lsmeans &subsub ⊂*&subsub &main*&subsub &main*⊂*&subsub/pdiff adjust=&adjust;
ods exclude overallanova ModelANOVA classlevels FitStatistics AltErrTests diff lsmeans nobs;
run;quit;
/*PROC GLM ENDS HERE*/
ods listing;
ods trace off;
/*PROC IML STARTS HERE*/
proc IML;
/*Final Anova Table formation*/
reset spaces=3 noname;
use typeI;
read all var{DF SS MS FValue ProbF} into x; /*matrix with DF SS MS FValue and ProbF for type I ss*/
source1 = x[6:10, ];
source2 = x[3, ];
use total_ss;
read all var{DF SS MS FValue ProbF} into z;/*read point{2,3} var{DF SS MS FValue ProbF} into z*/
z1 = z[2:3, ];
use error_sub;
read all var{DF SS MS FValue ProbF} into x1;/*reads all obsevations for var DF SS MS FValue ProbF*/
x2 = x1[1:2, ];
x3 = x1[3:4, ];
anova = x2//source2//x3//source1//z1;
create finalanova from anova;
append from anova;
/*Reading values of Rep, A, B and C*/
use variables;
read all var{levels} into levels;
r=levels[1,];
a=levels[2,];
b=levels[3,];
c=levels[4,];
quit;
Data finalanova;
Length Source $40;
format siglevel $10. COL2 20.2 COL3 20.2 COL4 20.2 COL5 20.2;
set finalanova;
Label siglevel="Significant";
Label COL1 = "DF" COL2='Sum of Square' COL3 ='Mean of Square' COL4 ='F-Ratio' COL5= 'p-Value';
If _N_ = 1 Then Source =compress("&block_var") ;
If _N_ = 2 Then Source = "&main" ;
If _N_ = 3 Then Source = "Error(&main)" ;
If _N_ = 4 Then Source = "⊂" ;
If _N_ = 5 Then Source = "&main*⊂" ;
If _N_ = 6 Then Source = "Error(⊂)";
If _N_ = 7 Then Source = "&subsub";
If _N_ = 8 Then Source = "&main*&subsub";
If _N_ = 9 Then Source = "⊂*&subsub";
If _N_ = 10 Then Source = "&main*⊂*&subsub";
If _N_ = 11 Then Source = "Error(&subsub)";
If _N_ = 12 Then Source = "Total" ;
If Source = "Error(&main)" Then Do;
COL4=.; COL5=. ;
End;
If Source = "Error(⊂)" Then Do;
COL4=.; COL5=. ;
End;
If COL5>0.05 Then Siglevel='NS';
Else If Compress(COL5)='_' or Compress(COL5)=. Then Siglevel=' ';
Else If COL5 gt 0.01 and COL5 le 0.05 Then Siglevel = '*';
Else If COL5 le 0.01 and COL5 ge 0.00000000000 Then Siglevel = '**';
run;
Title3 j=c "ANOVA Table - Dependent Variable is &dep";
Proc Report Data=finalanova Nowd
style(header)=[TEXTALIGN=C] style(lines)=[font=(Arial,9pt)];
Column Source COL1 COL2 COL3 COL4 COL5 Siglevel;
Compute after;
Line " ** - Significant at 1%, * - Significant at 5%, NS - Non Significant " ;
Endcomp;
Run;
ods rtf close;
%mend split_split;
/* Calling the macro. Make sure you are using appropriate macro variables */
%split_split(ds=&ds, dep=&dep_var, main=&main_plot, sub=&sub_plot, subsub=&subsub_plot);
[/pre]
Regards,
Manoj Khandelwal
... View more