/*Using ODS to produce result data sets*/ /*www.estat.us*/ /*I usually suppress the priting off the procedures in this way and then later use PROC PRINT to see the content of result data sets. ods listing close; ods listing; */ /*How to check what result data sets are available*/ /*sandwitch any procedures with ODS TRACE ON and ODS TRACE OFF and then see the log file*/ ods trace on; proc contents;run; ods trace off; /*I got this in my log file. This means that I can request three result data sets. Attributes, EngineHost, and Variables. Output Added: ------------- Name: Attributes Label: Attributes Template: Base.Contents.Attributes Path: Contents.DataSet.Attributes ------------- Output Added: ------------- Name: EngineHost Label: Engine/Host Information Template: Base.Contents.EngineHost Path: Contents.DataSet.EngineHost ------------- Output Added: ------------- Name: Variables Label: Variables Template: Base.Contents.Variables Path: Contents.DataSet.Variables ------------- */ /*So I can do this*/ proc contents; ods output Attributes=A EngineHost=B Variables=C run; proc print data=A;run; proc print data=B;run; proc print data=C;run; /*Let's look at other procedures*/ /*PROC MEANS*/ /*also I show how to use "ods listing close" to supress printing and "ods listing" to begin printing. This is useful when the print out from the PROC is too much*/ ods listing close; proc means data=sashelp.class; ods output summary=john; run; ods listing; proc print data=john; run; /*PROC FREQ*/ proc freq data=sashelp.class; ods output OneWayFreqs=mary; run; proc print data=mary; run; proc freq data=sashelp.class; tables sex*age/CHISQ; ods output ChiSq =david; run; proc print data=david;run; /*PROC TTEST*/ proc ttest data=sashelp.class alpha=.05; class sex; var weight ; ods output statistics=susan equality=james TTests=jeana; run; proc print data=susan;run; proc print data=james;run; proc print data=jeana;run;