BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Phil_NZ
Barite | Level 11

Hi all SAS Users,

I am in a critical issue that when I use Stata and SAS, I have different results

 

What I want is that I want to run a Difference-in-Difference regression by using OLS with fixed effects (firms (TYPE) and years(yr)).

My code in STATA is:

encode TYPE, generate(TYPE2)


areg wROE pt wTOT_ASS_TUR wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION wLEVERAGE pri_ove_ern i.yr, a(TYPE2)

 

My result by running in STATA is:

Phil_NZ_0-1620193874268.png

As can be seen from the picture above, the coefficient of pt is 0.0026, positive.

However, I replicate this regression in SAS by using the code below:

proc glm data=merge_treat_con;
    ABSORB TYPE;
    class yr;
    model wROE= pt TOT_ASS_TUR wFIRM_SIZE LNGDP UNEMPLOYMENT INFLATION 
		 wLEVERAGE pri_ove_ear yr/solution ss3;
run;
quit;

It generates a WARNING but I hope it is not a critical mistake

WARNING: Formatted ABSORB values not sorted in ascending sequence.

And the result is as below:

Phil_NZ_1-1620193990419.png

 

 

Boom, the coefficient of pt now is -0.016, negative.

I am wondering which cause these difference and what is the way to get out of this situation?

I highly appreciate any comment and suggestion. Thank you for spending time with me in advance.

Warm regards.

Phil.

 

 

 

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

YR1991 is in the SAS output, but not in the STATA output. That may be a different parameterization of the model, which of course would result in different coefficients. Or maybe it's something different.


The F-test in SAS has 44781 degrees of freedom in the numerator, but STATA shows only 33 degrees of freedom in the numerator of the F-test.

 

So, these are not fitting the same model.

--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26

YR1991 is in the SAS output, but not in the STATA output. That may be a different parameterization of the model, which of course would result in different coefficients. Or maybe it's something different.


The F-test in SAS has 44781 degrees of freedom in the numerator, but STATA shows only 33 degrees of freedom in the numerator of the F-test.

 

So, these are not fitting the same model.

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 1156 views
  • 1 like
  • 2 in conversation