BookmarkSubscribeRSS Feed
econjoe
Calcite | Level 5

Is there a SAS equivalent to Stata's areg command? Specifically, I'm looking for a procedure that will replicate the following Stata command:

 

areg depvar indvar, absorb(id1) cluster(id2)

 

In this case id1 is nested within id2.

 

The proc genmod below clusters the standard errors at the id2 level, but is not able to absorb id1.
 
proc genmod;
  class id2;
  model depvar = indvar;
  repeated subject=id2 / type=ind;
run;
 
The proc glm below absorbs id1 but cannot cluster the standard errors at the id2 level.
 
proc glm;
  absorb id1;
  model depvar = indvar / solution noint;
run;
 
Is there a simple way to both absorb id1 and cluster on id2?
1 REPLY 1
SteveDenham
Jade | Level 19

I am not real sure, but would some sort of hierarchical model, such as GLIMMIX work for what you want?

 

proc glimmix data=have;

class id1 id2;

model depvar=indvar;

random intercept/subject=id1;

random _residual_/subject=id2(id1) type=vc;

run;

 

Steve Denham

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 3042 views
  • 0 likes
  • 2 in conversation