SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
StataUser
Calcite | Level 5

Hello, I am very new to SAS and am currently trying to translate some Stata code, including a regression. I am able to successfully get the same coefficients in the output but I haven't been able to save them. This is the code I am using:

proc glm;

absorb ID;

model kw = i txi / solution noint;

run;

quit;

I haven't been able to use the OUTPUT command (it says this can not be used with absorb) and OUTSTAT doesn't contain the coefficients. OUTEST doesn't seem to work with Proc glm either. I just need to save the coefficients since I'll be running this multiple times on large datasets.

Any help would be greatly appreciated!

4 REPLIES 4
Doc_Duke
Rhodochrosite | Level 12

You can output the coefficients using the ODS capabilities.  See the ODS Output section of the SAS documentation for your version of PROC GLM.  In 12.1, the table is named ParameterEstimates.

PaigeMiller
Diamond | Level 26

@Doc_Duke wrote:

You can output the coefficients using the ODS capabilities.  See the ODS Output section of the SAS documentation for your version of PROC GLM.  In 12.1, the table is named ParameterEstimates.


When you use ABSORB, you cannot get coefficients for the main effects in the ABSORB statement — you can't get these coefficients via ODS or in some output destination like HTML. Why? Because SAS doesn't compute them. (You can get coefficients for other terms in the model, just not the coefficients for terms in the ABSORB statement).

 

This is a tradeoff you make when you choose ABSORB, the model is computed faster and uses less memory, but as a result you can't get coefficients for the ABSORBed variables.

 

According to the documentation at: https://documentation.sas.com/?cdcId=pgmmvacdc&cdcVersion=9.4&docsetId=statug&docsetTarget=statug_gl...

 

For a main-effect variable that does not participate in interactions, you can absorb the effect by naming it in an ABSORB statement. This means that the effect can be adjusted out before the construction and solution of the rest of the model. This is particularly useful when the effect has a large number of levels.

 

Note: When you use the ABSORB statement, the data set (or each BY group, if a BY statement appears) must be sorted by the variables in the ABSORB statement. The GLM procedure cannot produce predicted values or least squares means (LS-means) or create an output data set of diagnostic values if an ABSORB statement is used.

--
Paige Miller
Ksharp
Super User
ods trace on;
proc glm data=sashelp.class;
class sex;
 model weight=sex height;
ods output FitStatistics=want1 OverallANOVA=want2;
run;
ods trace off;

Ksharp

Cecillia_Mao
Obsidian | Level 7

Check out ods output table names. For instance, HOVFTest is for Homogeneity of variance ANOVA

 

 

https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_glm_sect044...

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 11712 views
  • 1 like
  • 5 in conversation