/* S A S S A M P L E L I B R A R Y */ /* */ /* THIS IS A VERY GOOD EXAMPLE FROM SAS SAM.G. 11/4/08 */ /* */ /* NAME: ODSREG1 */ /* TITLE: Generates ODS Output Data Sets */ /* PRODUCT: BASE */ /* SYSTEM: ALL */ /* KEYS: ODS HTML OUTPUT */ /* PROCS: REG */ /* DATA: */ /* SUPPORT: UPDATE: */ /* REF: */ /* MISC: */ /* */ /****************************************************************/ options center; /* Point ODS in the right direction. */ /* Notice we are NOT closing the Listing file: */ /* HTML, Monospace, and Output Data sets will be created. */ ods html file="c:\Users\ccsam\sas\odsreg1.htm"; data test; input y x1 x2 x3 by1 by2 $; if by2='b' then y1 = 5;else y1=y; weight=1/(x1**2); int=1; cards; 10 10 16 22 1 a 17 16 19 12 1 a 13 27 16 19 1 a 17 25 21 15 1 a 14 17 15 13 2 a 18 18 17 16 2 a 31 25 28 19 2 b 28 19 22 21 2 b 33 16 18 20 1 b 31 26 24 22 1 b 19 17 16 15 1 b 22 29 17 15 1 c 24 15 17 22 2 c 16 12 14 18 2 c 27 29 25 24 2 c 16 18 17 13 2 c run; /* Use the ODS OUTPUT statement to create your Output data */ /* set from the ANOVA Output Object. */ ods output ANOVA=anova_out; /* Report and Create a data set from the ANOVA */ /* Output Object. */ proc reg data=test; ods select ANOVA; model y1 = x1; model y = x2; run; /* Print the newly generated Analysis of Variance */ /* Output Data Set. */ proc print data=anova_out; title2 'Print: Analysis of Variance data set for both models'; run; /* All done, let us take a look. */ /* Be sure to check both HTML and Monospace Listing Output. */ ods html close;