4. PROC GENMOD Commands Many SAS users who apply statistical methods to data are familiar with procedures such as PROCs REG and GLM for regression and analysis of variance/covariance models and perhaps the relatively new PROC MIXED for fitting linear models for continuous data. PROC GENMOD can also compute fixed effect linear models with normally distributed residuals; however, its primary function is to work with data based on other types of distributions such as the binomial for dichotomous data and Poisson or negative binomial models for counts. In addition, a special feature of PROC GENMOD is that it can accommodate the analysis of correlated discrete data in a manner similar to how PROC MIXED works with correlated continuous data under a an estimation technique known as Generalized Estimating Equations (GEE). PROC GENMOD can analyze simple as well as very complex statistical models. Other SAS procedures also exist which perform the same analysis; however, some features may exist in these procedures which are missing in PROC GENMOD but still is important to know the differences and advantages of each. Examples are given showing how PROC GENMOD will analyze various types of response data which do not meet the assumptions of normality of the residuals. The following statements for the GENMOD procedure resemble the analogous statements in PROC GLM or PROC MIXED and have similar or the same functions. Items enclosed within the <> are optional. PROC GENMOD < options > ; BY variables ; CLASS variables / ; FREQ variable ; MODEL response = < effects > < /options > ; CONTRAST 'label' effect < ...effect values > < /options > ; ESTIMATE 'label' effect < ...effect values > < /options > ; LSMEANS effects < / options > ; OUTPUT OUT=dataset < keyword=name...keyword=name > ; REPEATED SUBJECT= subject-effect < / options > ; RUN; The functions of these statements and their relevant options will be covered in the several subsequent sections in the GENMOD web-page. When working with classification data, the CLASS statement functions much like it does in PROC MIXED or GLM. That is, it applies GLM coding (dummy variables equal to 0 or 1) to the levels of the factors with the highest coded value serving as the reference category. Effect coding is also available, where the levels are set to -1 or +1 which is achieved with PARAM= option on the CLASS statement: CLASS fctr / PARAM= effect; The FREQ statement is necessary when records containing variables with identical values are stored in one record in the file containing a variable which indicates how many duplicate records this one record represents. Other statements include the ability to define your own models (i.e. you define the link, variance and deviance functions). These statements allow you to enter special mathematical relationships for the mean and variance of the response. Several other SAS procedures are very helpful to summarize and explore the distributions of the data entered into or produced by PROC GENMOD. You should also be very familiar with the PRINT, SORT, TABULATE, TRANSPOSE, FREQ, and PLOT procedures, which are among the most important ones to know. GENMOD Compared with other SAS Procedures Other SAS procedures also compute generalized linear models. In some cases the outputs are exactly the same as GENMOD, others include important features not necessarily part of or even computable with GENMOD. For the various probability distributions, these procedures include: Normal Distribution: PROCs REG, ANOVA, GLM, MIXED Binomial and Multinomial: LOGISTIC, PROBIT, CATMOD PROCs NLMIXED and GLIMMIX compute generalized linear models, but also include the capability to incorporate random effects, much like the types of problems PROC MIXED can handle with random effects for continuous data. One of the features of PROC NLMIXED is the ability to enter the likelihood function directly into a set of statements which allows you to work with zero-inflated count data or censored continuous data, as important examples. How these other procedures relate to PROC GENMOD will be incorporated into several examples which follow.