Chapter Contents 
Previous 
Next 
Using the Output Delivery System 
Suppose the following insurance claims data are classified by two factors: age group (with two levels) and car type (with three levels).
data insure; input n c car$ age; ln = log(n); datalines; 500 42 small 1 1200 37 medium 1 100 1 large 1 400 101 small 2 500 73 medium 2 300 14 large 2 ;
In the data set insure, the variable n represents the number of insurance policyholders and the variable c represents the number of insurance claims. The variable car represents the type of car involved (classified into three groups) and the variable age is the age group of a policyholder (classified into two groups).
In the statements that follow, PROC GENMOD performs a Poisson regression analysis of these data with a log link function. Assume that the number of claims c has a Poisson probability distribution and that its mean, , is related to the factors car and age.
ods trace on; ods listing close; proc genmod data=insure; class car age; model c = car age / dist = poisson link = log offset = ln obstats; run; ods trace off;Output 15.6.1: The ODS TRACE: Partial Contents of the SAS Log

ods output ObStats=myObStats (keep=Car Age Pred rename=(Pred=PredictedValue)); proc genmod data=insure; class car age; model c = car age / dist = poisson link = log offset = ln obstats; run;
The KEEP= option in the ODS OUTPUT statement specifies that only the variables Car, Age, and Pred are written to the data set, and the Pred variable is renamed to PredictedValue. The GENMOD procedure is again invoked. In order to limit the amount of displayed output, the SAS listing destination remains closed. When a destination is closed, it remains closed until it is explicitly reopened.
In the following statements, the output data set myObStats is sorted, and the SAS listing is reopened for output. The results are displayed in Output 15.6.2.
proc sort data=myObStats; by descending PredictedValue; run; ods listing; proc print data=myObStats noobs; title 'Values of Car, Age, and the Predicted Values'; run;Output 15.6.2: The ObStats Table, Created as a SAS Data Set

Chapter Contents 
Previous 
Next 
Top 
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.