BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
JonKetchup
Obsidian | Level 7

I am trying to reproduce a GLM in SAS that I originally created in Stata. Although my estimates are exactly the same, the standard errors are not, and I'm not quite sure why. Note that cost is continuous while treatment, var1, and var2 are all categorical. Here is both codes:

SAS

proc genmod data=data;
 class clinician treatment var1 var2 / param=ref;
 model cost = treatment var1 var2/ link=LOG dist=gamma type3;
repeated SUBJECT=clinician/ PRINTMLE TYPE=ind;
run;

Stata

glm cost i.treatment i.var1 i.var2, f(gam) l(log) cluster(clinician)
testparm i.treatment

 

Appreciate the help

1 ACCEPTED SOLUTION

Accepted Solutions
JonKetchup
Obsidian | Level 7

Figured it out. The answer is twofold.

1) Genmod and Stata estimate the scale parameter and correlation structure slightly differently. Details are given on xtgee-related FAQ.

2) Genmod by default produces score type III tests while Stata produces Wald type III tests. Wald tests can be requested for SAS, but score tests cannot be produced by Stata.

View solution in original post

8 REPLIES 8
PaigeMiller
Diamond | Level 26

Are the degrees of freedom the same? Show us.

--
Paige Miller
JonKetchup
Obsidian | Level 7

Yes, DFs are all the same along with the estimates. Only the standard errors (and thus the p-values) are different)

PaigeMiller
Diamond | Level 26

How far apart are these estimates of standard errors? Give us a specific case, what are the actual numbers from SAS and what is the actual number in STATA?


What is the estimate of Scale from each program?

 

 

--
Paige Miller
JonKetchup
Obsidian | Level 7

The estimate for treatment is -0.0356. In SAS, the standard error is 0.1301 while in Stata, the standard error is 0.1469.

 

I'm not sure how to find the scale in Stata, but the scale is SAS is 0.5432.

PaigeMiller
Diamond | Level 26

I don't understand, it seems as if you have not answered my question, or you did answer my question but worded it confusingly.

 

The standard error for treatment in SAS is _________________

The standard error for treatment in STATA is _________________

--
Paige Miller
JonKetchup
Obsidian | Level 7

My apologies. My last reply had a few errors. It is rewritten, but to again answer your question:

The standard error for treatment in SAS is 0.1301.

The standard error for treatment in STATA is 0.1469.

PaigeMiller
Diamond | Level 26

Ok, so at this point, I have to say I don't really have enough familiarity with STATA to help further, but the problem (in my opinion) is either

 

  1. the SAS algorithm estimates scale and standard errors differently than STATA algorithm does; or
  2. the models specified are not identical (despite the matching estimates) because of the REPEATED command in PROC GENMOD produces different estimates of scale and different standard errors than STATA model specification does
--
Paige Miller
JonKetchup
Obsidian | Level 7

Figured it out. The answer is twofold.

1) Genmod and Stata estimate the scale parameter and correlation structure slightly differently. Details are given on xtgee-related FAQ.

2) Genmod by default produces score type III tests while Stata produces Wald type III tests. Wald tests can be requested for SAS, but score tests cannot be produced by Stata.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 8 replies
  • 1258 views
  • 1 like
  • 2 in conversation