BookmarkSubscribeRSS Feed
henribu
Calcite | Level 5

Hello,

 

I am currently trying to run the two stage heckman method

 

I am currently rewriting a stata program into SAS and there is a do file containing this method

 

I started by doing like this website to translate the stata into sas:

https://stats.idre.ucla.edu/sas/code/heckman-selection-model/

 

It runs ok but later in the stata code they are calling two parameters after this procedure: lambda and sigma

you can learn from these parameters here: https://www.stata.com/manuals13/rheckman.pdf

there are called in stata with e(lambda) and e(sigma)

 

The problem is the following: I have no idea how to access to these two parameters in SAS

I tried to find it with google without any success

Anyone has an idea?

I am currently using SAS entreprise guide 7.1

 

Many thanks for your help

 

 

2 REPLIES 2
PGStats
Opal | Level 21

Have you checked the implementation of this method in proc QLIM (part of SAS/ETS)?

 

https://documentation.sas.com/?docsetId=etsug&docsetTarget=etsug_qlim_details17.htm&docsetVersion=14...

PG
henribu
Calcite | Level 5

Hi,

 

Thanks for your answer

 

Yes I checked this and they are doing exactly what I am doing

 

The only thing that could be added to what I've mentioned is the heckit option 

But this does not tell me how to get access to the lambda and the sigma

 

For instance, if I should compute another variable that is depending of the lambda of the estimation,

how I should access to lambda in the code?

 

 

Moreover, I tried to replicate the results obtained with stata and they differ

I do not understand why

 

I ran the two regressions with exactly the same dataset and I obtained different results

 

proc qlim data=dtest;

model varex = var1 var2 var3/discrete;

model varex2 = var2 var4 var5 select(varex=1);

nloptions maxiter=4000000;

run;

 

I also tried with the heckit option

 

proc qlim data=dtest heckit ;

model varex = var1 var2 var3/discrete;

model varex2 = var2 var4 var5 select(varex=1);

nloptions maxiter=4000000;

run;

 

and I am still obtaining different results than with stata and the following code:

heckman  varex2 = var2 var4 var5   if varex == 1, select(var1 var2 var3)

 

Many thanks if someone has any idea

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 923 views
  • 0 likes
  • 2 in conversation