turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Ouput coefficients from GLS regression without ODS

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 12:06 PM

Hello everyone,

I would like to output the coefficients and their standard errors from a GLS regression, as well as the residuals and predicted values.

The following code does the job:

```
proc glm data=Work.Rwin;
by grp;
model Y1 = X1 X2 X3 X4 X5 X6 / noint;
ods output ParameterEstimates=Work.Coeff1; /* output coeff and their standard errors */
run;
quit;
proc glm data=Work.Rwin noprint;
by grp;
model Y1 = X1 X2 X3 X4 X5 X6 / noint;
output out=Work.Res1 p=predicted1 r=residus1; /* output residuals and predicted values */
run;
quit;
```

After searching on the forum and Internet, ODS is the only way I found to output the coefficients. The problem is that ODS requires to print, which is a an extremely long process given that I have thousands of rolling-windows regressions like this...

If you have any suggestion to improve this code and make it faster to process I would be very grateful. The best solution would be not to use ODS I think, and if it's not possible maybe to output everything with ODS instead of doing the regressions 2 times like this (with ODS first then with output out).

Thank you in advance for your help,

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 12:39 PM

Perhaps ODS Exclude or %ODS off/on may assist:

http://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 12:51 PM

I will look deeper into ODS EXCLUDE if it allows printing only coefficients and their standard errors, throwing away everything else. In this case it may be faster indeed, thank you.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 12:56 PM

In your example, you have only main effects. There4fore you can use PROC REG instead of PROC GLM and use the OUTEST= option to write the parameter estimates. By the way, you can output all statistics in one call; no need to run the PROC twice:

```
proc reg data=Work.Rwin noprint outest=PE;
by grp;
model Y1 = X1 X2 X3 X4 X5 X6 / noint;
output out=Res1 p=predicted1 r=residus1;
quit;
```

For a summary of other ways to output statistics in SAS, see "ODS OUTPUT: Store any statistic create by any SAS procedure."

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 01:07 PM - edited 04-24-2017 01:12 PM

When I started to write this program, I indeed outputted all the parameter estimates in one call:

```
proc reg data=Work.Rwin outest=Work.Coeff1 tableout noprint;
by grp;
model Y1 = X1 X2 X3 X4 X5 X6 / noint;
output out=Work.Res1 p=predicted1 r=residus1;
run;
quit;
```

using "tableout" to get additional information, notably standard errors. But this is an OLS regression and I have substantial first-order autocorrelation in the error that I would like to adjust by estimating coefficients with the GLS method. That's why I use PROC GLM instead of PROC REG. Am I mistaken?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 01:33 PM

I think you are mistaken. PROC GLM performs OLS for general linear models. It differs from PROC REG in that it supports a CLASS statement that internally generates dummy variables for categorical covariates. It also supports ANOVA, MANOVA, and various hypothesis testing methods.

if you have autocorrelated data, you might want to look into the SAS/ETS procedures such as PROC AUTOREG, which provides Yule-Walker estimates.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-24-2017 02:19 PM

Ah ok thank you, so I need to look how we perform GLS regressions with SAS (using GLS is a requirement in my case as I reproduce a procedure). Any hint?