Dear,
The ODS system is not new to me, however its potential for writing (rtf) reports is. The information seems overwhelming and very scattered, and I read that there are differences between SAS 9.4 and 9.2. I was planning to buy the above mentioned book, but wonder whether it is not outdated. I hope to get some feedback. - Thanks, Veronique
RTF is a plain text file format markup (i.e. it has codes to tell the renderer how to display the text), much like HTML or XML. It has been around for many decades, and has not been updated much in quite a long time. Therefore I really don't see there being much difference between any of the 9.X versions of SAS in this respect. The Output Delivery System had a major overhaul for version 9 and various updates over the releases, but the basics haven't really changed, the main thing is learning an output procedure like report or print or tabulate. If you want to create an RTF its as simple as;
ods rtf file="want.rtf" style=statistical; proc print data=sashelp.class; run; ods rtf close;
Open the destination, print to it, close it. As for the book, I don't know it myself, I hear the Little SAS Book is quite good, get the latest version of whichever book you are looking at, or just get the free SAS learning materials:
http://video.sas.com/#category/videos/how-to-tutorials
And other online guides.
Well, I am more advanced than that. I managed already a short report such as:
ODS RTF FILE="&path.ODSreport.rtf" style=analysis
sasdate
startpage=never
nogfootnote;
footnote "author V. Storme";
ODS ESCAPECHAR='^';
* ODS noproctitle;
title justify=right 'Page ^{pageof}';
title '^S={preimage="G:\vesto\VESTO\Templates\psb_small.jpg"} ^{newline 2}';
options orientation=portrait;
ods graphics on / width=8cm height=6cm;
title2 "^{newline 1} Sample size calculation for the flower phospho proteomics data. ^{newline 1}" ;
proc odstext;
p 'A pilot study was performed on wheat under two temperature conditions with 3 biological replicates for each condition.
5581 peptides were identified. The data set contained 114580 zero values. For the purpose of sample size calculations,
only the 2991 peptides were used with no zero values.' ;
p 'Mean and standard deviation (SD) of the log2 intensity values of each peptide were calculated.';
p 'The median, quartiles, 10th and 90th percentile of these means and SDs were calculated and listed below.';
run;
title2;
proc means data = &lib..descr P10 P25 P50 P75 P90 maxdec=2 ;
var mean;
run;
* 22.4 23.4 24.6 25.8 27.1 ;
proc means data = &lib..descr P10 P25 P50 P75 P90 maxdec=2 ;
var SD;
run;
proc means data = &lib..descr noprint P50 P75 maxdec=2 ;
var SD;
output out=quantiles P50=p50 P75=p75 ;
run;
* 0.10, 0.17, 0.30, 0.56, 0.92 ;
data _NULL_;
set quantiles;
call symput('P50',strip(put(P50,5.2)));
call symput('P75',strip(put(P75,5.2)));
run;
proc odstext;
p "The interest is in detecting a two-fold change between the two temperature conditions at a p-value
of 0.004. This was the threshold p-value to obtain an FDR adjusted p-value of 0.05 in a related sudy.
A sample size calculation was performed assuming a SD of &P50 and &P75, corresponding to the median
and upper quartile of all SDs of the 2991 peptides. A power of 85% was taken. The sample size calculation
was performed with the proc power for a T-test assuming equal variances and equal group sizes. The plot is shown below.";
run;
* sample size calculation for ttests;
* assuming unequal variances, one setting;
* Satterthwaite unpooled t-test;
* effect size 2 fold change;
* based on data Jelle, a p-value of 0.004 was required to obtain an FDR adjusted value of 0.05;
* take 0.001 to be on the save side;
*ods rtf startpage=now ;
ods select PowerPlot;
proc power;
twosamplemeans test=diff sides=2
meandiff = 1
stddev = 0.30 0.56
groupweights = 1|1
power = 0.85
alpha = 0.004
ntotal = . ;
plot y=power min=0 max=1 yopts=(ref=0.9 crossref=yes) vary (color) ;
run;
* 6 samples in each group are required for a sd of 0.30 ;
* 13 samples in each group are required for a sd of 0.56 ;
proc odstext ;
p "In conclusion, 6 samples are required for each temperature condition for a SD of &P50 and 13 for a
SD of &P75.." ;
run;
ods rtf close;
So what is it you wanted to learn? Is it RTF codes? If so pickup the free specification document from MS:
https://www.microsoft.com/en-us/download/details.aspx?id=10725
If you're there already, I'm not sure it will add more value. And the documentation for the ODS options have gotten a lot better.
I don't think being outdated would be the major issue, since ODS RTF hasn't changed that much. I would suggest looking at the table of contents and if there's something you want to learn there, then buy the book.
I would for instance like to know how I can add references to my figures, and how I can add captions below my figures, explaining the abbreviations.
Look through this blog:
https://blogs.sas.com/content/graphicallyspeaking/
It has examples on pretty much anything you would ever want to do with graphs/figures. May take a bit of searching, but it is a very comprehensive source of material.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.