The script begins by creating a dataset named 'nor' using a DATA step and in-line data (datalines). This dataset contains two variables, 'x' and 'y'. Subsequently, PROC GENMOD is used to fit a model where 'y' is the dependent variable and 'x' is the explanatory variable. The distribution is specified as 'normal' and the link function as 'log'. The OUTPUT statement of PROC GENMOD is used to save predictions and different types of residuals (raw, chi-square, deviance, etc.) into a new dataset named 'Residuals'. Finally, PROC PRINT is used to display the content of the 'Residuals' dataset, allowing for examination of model fit results and residual diagnostics.
Data Analysis
Type : CREATION_INTERNE
The 'nor' dataset is created directly within the script via a DATA step and in-line data (datalines). No external data or SASHELP data is used as initial input.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates a SAS dataset named 'nor'. It defines two numeric variables, 'x' and 'y', and populates them with values provided directly in the script via the DATALINES clause. This dataset will be used as input for the subsequent statistical procedure.
Explanation : This procedure uses PROC GENMOD to fit a generalized linear model to the 'nor' dataset. The variable 'y' is modeled as a function of 'x'. The `dist=normal` parameter specifies a normal distribution for the response, and `link=log` applies a logarithmic link function. The OUTPUT clause is used to generate a new 'Residuals' dataset containing predicted values ('Pred') and various types of residuals for diagnostic analysis of the model.
Copied!
proc genmod data=nor;
model y = x / dist = normal
link = log;
output out = Residuals
pred = Pred
resraw = Resraw
reschi = Reschi
resdev = Resdev
stdreschi = Stdreschi
stdresdev = Stdresdev
reslik = Reslik;
run;
1
PROC GENMODDATA=nor;
2
model y = x / dist = normal
3
link = log;
4
OUTPUT out = Residuals
5
pred = Pred
6
resraw = Resraw
7
reschi = Reschi
8
resdev = Resdev
9
stdreschi = Stdreschi
10
stdresdev = Stdresdev
11
reslik = Reslik;
12
RUN;
13
3 Code Block
PROC PRINT
Explanation : This block uses PROC PRINT to display the contents of the 'Residuals' dataset created by the previous PROC GENMOD. This allows visualization of model predictions and the various calculated residual measures.
Copied!
proc print data=Residuals;
run;
1
PROC PRINTDATA=Residuals;
2
RUN;
3
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : S A S S A M P L E L I B R A R Y
Related Documentation
Aucune documentation spécifique pour cette catégorie.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.