This week's SAS tip is from Lauren Haworth, Cynthia L. Zender, and Michele Burlew's book Output Delivery System: The Basics and Beyond. This monumental guide is packed with a wide-array of techniques and examples. As SAS programmer Christine Iodice said, "This book is one-stop shopping for all your ODS needs!"
I hope you enjoy this week's featured book excerpt. If you'd like more information, visit our Web catalog to read reviews, the table of contents, and a free chapter. View previously featured tips from the book on this blog: Sending ODS output to your printer and Selecting variables to include in output.
The following excerpt is from SAS Press authors Lauren Haworth, Cynthia L. Zender, and Michele Burlew's book "Output Delivery System: The Basics and Beyond" Copyright © 2009, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software).
The %DO loop in this example is inefficient because there is a lot of overhead involved in running a procedure multiple time. A more efficient approach is to sort the data by the PLANT variable and then run the following:
ods graphics off; ods exclude all; ods noresults; /* turn off ODS output */
ODS OUTPUT TTests=TTest;
proc ttest data=product
ods graphics on; ods exclude none; ods results; /* turn on ODS output */
Notice also that I prefer ODS EXCLUDE, rather than closing the destination.
For an explanation, see Simulation in SAS: The slow way or the BY way.