The linear model edit
- proc reg
- One can also use the proc glm
- The least square estimator can be programmed using the IML procedure. See Least Square in IML section.
The model instruction gives the model. The outcome is on the lefthandside of the = sign. All explanatory variables are on the right handside. The constant is included by default.
- Note that the proc reg is an interactive command. Therefore you have to add quit; after the command.
proc reg data = mylib.mydata ; model y = x1 x2 x3; run; quit;
- The clb option in the model statement gives the 95% confidence interval.
proc reg data = data_name; model y = x1 x2 x3 /clb; run; quit;
- The test statement adds tests for linear hypothesis.
- the output statement creates a table with the residuals.
proc reg data = data-name; model y =x1 x2 x3; test x1=1, x1+x2 = 0; output out=est residual=resid yhat = predicted; run; quit;
You can also store parameters in a new database :
proc reg data=data_name outest=est; model y = x ; run ; quit ; proc print data=est ; run ;
- Output the main calculation steps :
proc reg data = base ; model y = x / I XPX ; run ; quit ;
Robust Regressions edit
proc robustreg data=lib.ficus (where =(effec > 0 & effec < 100)) method=m (wf=huber) ; model eff_moy = effec; output out = robustreg weight = wgt; run; quit ;
See Also edit
Instrumental Variables edit
You can perform 2 stage least square estimation with a 'proc syslin' and the '2sls' option. You specify the endogenous predictors in the endogenous statement, the instrument in the instruments statement and your model in the model statement.
proc syslin data = endogen 2sls ; endogenous x1 ; instruments z1 ; model y = x1 ; run ; quit ;
Panel data edit
- PROC TSCSREG provides options for fixed and random effects models.