proc sort data = restricted; by descending race; run ; 7
EPI204 – Lab Session 1 proc glm data = restricted order =data; class race; model fvc = ageyrs height sex wt race/ solution ; title "GLM: Linear regression model" ; run ; quit ; In your output, do you have any notes? What does this mean? Is your output valid? 4.4 Product terms PROC REG: The product terms must be created in a former data step and included as separate covariates after the equal sign in the MODEL statement. PROC GLM: It can accommodate product terms between explanatory variables with the use of the variable1*variable2 form in the MODEL statement. The effect of age on FVC may be modified by gender. Check whether there is a significant interaction between age and gender in a model that only includes age and gender. data restricted; set restricted; agesex=ageyrs*sex; title "Creating a product term" ; run ; proc reg data = restricted; model fvc = ageyrs sex agesex; title "REG: Linear regression model with a product term" ; run ; proc glm data = restricted order =data; model fvc = ageyrs sex ageyrs*sex/ solution ; title "GLM: Linear regression model with a product term" ; run ; quit; Write out the model you’ve fit. Describe the effect of age on FVC based on the results from the model with the interaction term. 4.5 Incorporating sampling weights Suppose your sample was not selected randomly with equal probability of each individual being sampled; instead, you oversampled certain types of people and vice versa. If you know their sampling probability, you can then incorporate weights into your analyses to account for this in your estimates. For example, instead of fitting this model: /* Q11 */ proc sort ; by descending race; run ; proc sort ; by descending sex; run ; proc sort ; by descending bmi; run ; proc sort ; by descending booze_cat; run ; 8
EPI204 – Lab Session 1 proc glm order =data; weight exam_wt; model servitc = ageyrs bmi race sex booze_cat / solution ; run ; we can incorporate weights to fit this model: proc glm data = mydata; weight myweights; model y = x / solution ; run ; References 1. SAS help and documentation. Available from: 2. Delwiche and Slaughter. The Little SAS Book. 3 rd Edition. 2003. SAS Institute Inc. 9
You've reached the end of your free preview.
Want to read all 9 pages?