Getting Started Example 2 for PROC GENMOD


/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: GENMGS2                                             */
/*   TITLE: Getting Started Example 2 for PROC GENMOD           */
/* PRODUCT: STAT                                                */
/*  SYSTEM: ALL                                                 */
/*    KEYS: generalized linear models, Bayesian analysis        */
/*   PROCS: GENMOD                                              */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: sasgjj                                              */
/*     REF: PROC GENMOD, INTRODUCTORY EXAMPLE 2.                */
/*    MISC:                                                     */
/****************************************************************/

data Surg;
   input x1 x2 x3 x4 y logy;
   label x1 = 'Blood Clotting Score';
   label x2 = 'Prognostic Index';
   label x3 = 'Enzyme Function Test Score';
   label x4 = 'Liver Function Test Score';
   label y = 'Survival Time';
   Logx1 = log(x1);
   datalines;
6.7  62   81  2.59  200  2.3010
5.1  59   66  1.70  101  2.0043
7.4  57   83  2.16  204  2.3096
6.5  73   41  2.01  101  2.0043
7.8  65  115  4.30  509  2.7067
5.8  38   72  1.42   80  1.9031
5.7  46   63  1.91   80  1.9031
3.7  68   81  2.57  127  2.1038
6.0  67   93  2.50  202  2.3054
3.7  76   94  2.40  203  2.3075
6.3  84   83  4.13  329  2.5172
6.7  51   43  1.86   65  1.8129
5.8  96  114  3.95  830  2.9191
5.8  83   88  3.95  330  2.5185
7.7  62   67  3.40  168  2.2253
7.4  74   68  2.40  217  2.3365
6.0  85   28  2.98   87  1.9395
3.7  51   41  1.55   34  1.5315
7.3  68   74  3.56  215  2.3324
5.6  57   87  3.02  172  2.2355
5.2  52   76  2.85  109  2.0374
3.4  83   53  1.12  136  2.1335
6.7  26   68  2.10   70  1.8451
5.8  67   86  3.40  220  2.3424
6.3  59  100  2.95  276  2.4409
5.8  61   73  3.50  144  2.1584
5.2  52   86  2.45  181  2.2577
11.2 76   90  5.59  574  2.7589
5.2  54   56  2.71   72  1.8573
5.8  76   59  2.58  178  2.2504
3.2  64   65  0.74   71  1.8513
8.7  45   23  2.52   58  1.7634
5.0  59   73  3.50  116  2.0645
5.8  72   93  3.30  295  2.4698
5.4  58   70  2.64  115  2.0607
5.3  51   99  2.60  184  2.2648
2.6  74   86  2.05  118  2.0719
4.3   8  119  2.85  120  2.0792
4.8  61   76  2.45  151  2.1790
5.4  52   88  1.81  148  2.1703
5.2  49   72  1.84   95  1.9777
3.6  28   99  1.30   75  1.8751
8.8  86   88  6.40  483  2.6840
6.5  56   77  2.85  153  2.1847
3.4  77   93  1.48  191  2.2810
6.5  40   84  3.00  123  2.0899
4.5  73  106  3.05  311  2.4928
4.8  86  101  4.10  398  2.5999
5.1  67   77  2.86  158  2.1987
3.9  82  103  4.55  310  2.4914
6.6  77   46  1.95  124  2.0934
6.4  85   40  1.21  125  2.0969
6.4  59   85  2.33  198  2.2967
8.8  78   72  3.20  313  2.4955
;
proc print data=Surg (obs=20);
run;

proc genmod data=Surg;
   model y = Logx1 X2 X3 X4 / dist=normal;
   bayes seed=1 OutPost=PostSurg;
run;

data Prob;
   set PostSurg;
   Indicator = (logX1 > 0);
   label Indicator= 'log(Blood Clotting Score) > 0';
run;

proc Means data = Prob(keep=Indicator) n mean;
run;