The SAS Output Delivery System and reporting techniques

Awkward problem regarding ODS LISTING CLOSE.

Reply
Occasional Contributor
Posts: 19

Awkward problem regarding ODS LISTING CLOSE.

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
SAS Super FREQ
Posts: 8,743

Re: Awkward problem regarding ODS LISTING CLOSE.

Hi:
That note has nothing to do with ODS LISTING. The note is being issued by PROC GLM and it is the part of the output object created by PROC GLM (as shown in this Tech Support sample):
http://support.sas.com/kb/24/984.html

Everything that is created by PROC GLM will be sent forward to your ODS destination (in this case, RTF).

Your best bet for help will be to work with Tech Support they can tell you what your choices are and whether one of the following might work:
1) Alter your data or alter the GLM options to suppress the note;
2) Modify the table template used by GLM to see whether the NOTE can be suppressed here (I don't think this is a possibility, but I have not worked with GLM)
3) Save the GLM output objects to an ODS DOCUMENT store and delete the notes from the output objects. Then after the notes are deleted, replay the revised output objects to ODS RTF.

To send a question to Tech Support, go to http://support.sas.com/ and in the left-hand navigation pane, click on the link entitled "Submit a Problem". Alternately, you can go directly to the Tech Support Problem Form here:
http://support.sas.com/ctx/supportform/createForm

cynthia
Occasional Contributor
Posts: 19

Re: Awkward problem regarding ODS LISTING CLOSE.

Hi Cynthia,
Thanks for replying.

I have contacted with Tech Support but they haven't replied with any satisfactory answer. I used your 3rd option ODS DOCUMENT and I got that note but I am not unable to delete that entry. As I have to delete the entry by a generalizing statement (the code is very large I have pasted only a part of it, So it has to be general). The code which I am using is
[pre]
ods document name=work.split;
.....all the statements....
ods document close;

proc document name=work.split;
list/levels=all; /* optional */
run;
delete glm(where=(_type_ = 'note'));
run;
replay;
run;
Quit;
[/pre]
SAS Super FREQ
Posts: 8,743

Re: Awkward problem regarding ODS LISTING CLOSE.

Hi:
First, comparisons are case sensitive. Your object is not called 'note' -- the internally stored name of the note object will be something like what's shown in the path and the Type value is mixed case:
[pre]
Obs Path Type
------------------------------------------------------------------------------
15 \GLM#1\LSMEANS#1\row#1\Note#1 Note
20 \GLM#1\LSMEANS#1\col#1\Note#1 Note
25 \GLM#1\LSMEANS#1\row_col#1\Note#1 Note
[/pre]

...so the string 'note' will NEVER be found as the value of _TYPE_ and the note object will never be deleted.

I probably would have taken a slightly different approach. I think I would have just done a replay like this:
[pre]
ods pdf file='c:\temp\replay_where_NE.pdf';
proc document name=xxxxxx.yyyyyyyy;
replay ^(where=(_type_ ne 'Note')) ;
run;
quit;
ods _all_ close;
[/pre]

If you need to do rearranging, or you want to make an output object without the note then you could go the other route, but a simple REPLAY will leave the original output object intact and will allow you to send the output to your destination with the least amount of effort.

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 180 views
  • 0 likes
  • 2 in conversation