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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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