BookmarkSubscribeRSS Feed
LineDamsgaard
Calcite | Level 5

Hi, 

 

I'm attempting to "translate" code from STATA to SAS (with a few changes) for a negative binomial regression analysis. However there seems to be one function in STATA where I can't find the equivalent SAS command; the below STATA code contains the option "nocons", which specifies that a categorical variable should be treated as if it has no base, or, in other words, that all levels of the variable is kept in the model. 

I would like to do the same in SAS but I can't find a way to do this.

 

STATA code:

nbreg var1 var2#var3, irr nocons exp(var4) vce(cluster var5)

 

SAS code (without nocons equivalent):

proc genmod data=data;

class var2 var3 var4 var5;

model var1=var2 var3 var2*var3 / type3 dist=negbin offset=var6;

repeated sub=var4(var5) / type=unstr;

run;

 

Thanks!

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Use the NOINT option of the MODEL statement.

 

in other words, that all levels of the variable is kept in the model. 

 

Let me point out that the model fit with the NOINT and the model if you don't use NOINT are identical, the predicted values and fit does not change. So all levels are kept in the model, either way you do it. You are just changing the parameterization of the model, not the model itself. See my explanation here.

--
Paige Miller
sbxkoenk
SAS Super FREQ

Hello,

 

Are you talking about the construction of the design matrix?

You can specify an overparameterized model by using the PARAM=GLM option in the CLASS statement.
A CLASS main effect (an X-variable) with k-levels will then be "translated" to the design matrix as k dummy (0/1) columns.

 

SAS/STAT 15.2 User's Guide
The GENMOD Procedure
Parameterization Used in PROC GENMOD
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_genmod_details12.htm
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_genmod_syntax05.htm#statug.g...

 

PARAM=GLM : Less-than-full-rank reference cell coding

 

Cheers,

Koen

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1138 views
  • 0 likes
  • 3 in conversation