Chapter Contents |
Previous |
Next |
The REG Procedure |
model y=x1 x1*x1;is not valid. Note that this MODEL statement is valid in the GLM procedure.
The input data set for most applications of PROC REG contains standard rectangular data, but special TYPE=CORR, TYPE=COV, or TYPE=SSCP data sets can also be used. TYPE=CORR and TYPE=COV data sets created by the CORR procedure contain means and standard deviations. In addition, TYPE=CORR data sets contain correlations and TYPE=COV data sets contain covariances. TYPE=SSCP data sets created in previous runs of PROC REG that used the OUTSSCP= option contain the sums of squares and crossproducts of the variables. See Appendix A, "Special SAS Data Sets," and the "SAS Files" section in SAS Language Reference: Concepts for more information on special SAS data sets.
These summary files save CPU time. It takes nk2 operations (where n=number of observations and k=number of variables) to calculate crossproducts; the regressions are of the order k3. When n is in the thousands and k is less than 10, you can save 99 percent of the CPU time by reusing the SSCP matrix rather than recomputing it.
When you want to use a special SAS data set as input, PROC REG must determine the TYPE for the data set. PROC CORR and PROC REG automatically set the type for their output data sets. However, if you create the data set by some other means (such as a DATA step) you must specify its type with the TYPE= data set option. If the TYPE for the data set is not specified when the data set is created, you can specify TYPE= as a data set option in the DATA= option in the PROC REG statement. For example,
proc reg data=a(type=corr);
When TYPE=CORR, TYPE=COV, or TYPE=SSCP data sets are used with PROC REG, statements and options that require the original data values have no effect. The OUTPUT, PAINT, PLOT, and REWEIGHT statements and the MODEL and PRINT statement options P, R, CLM, CLI, DW, INFLUENCE, and PARTIAL are disabled since the original observations needed to calculate predicted and residual values are not present.
proc corr data=fitness outp=r noprint; var Oxygen RunTime Age Weight RunPulse MaxPulse RestPulse; proc print data=r; proc reg data=r; model Oxygen=RunTime Age Weight; run;
Since the OUTP= data set from PROC CORR is automatically set to TYPE=CORR, the TYPE= data set option is not required in this example. The data set containing the correlation matrix is displayed by the PRINT procedure as shown in Figure 55.11. Figure 55.12 shows results from the regression using the TYPE=CORR data as an input data set.
|
proc reg data=fitness outsscp=sscp noprint; model Oxygen=RunTime Age Weight RunPulse MaxPulse RestPulse; proc print data=sscp; proc reg data=sscp; model Oxygen=RunTime Age Weight; run;First, all variables are used to fit the data and create the SSCP data set. Figure 55.13 shows the PROC PRINT display of the SSCP data set. The SSCP data set is then used as the input data set for PROC REG, and a reduced model is fit to the data. Figure 55.14 also shows the PROC REG results for the reduced model. (For the PROC REG results for the full model, see Figure 55.26.)
In the preceding example, the TYPE= data set option is not required since PROC REG sets the OUTSSCP= data set to TYPE=SSCP.
|
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.