Programming the statistical procedures from SAS

2-stage least squares in SAS

Reply
Occasional Contributor
Posts: 9

2-stage least squares in SAS

I have a longitudinal unbalanced panel dataset (i.e., some variables have missing data), consisting of x year-observations per firm for a sample of firms across a large number of industries.  The substantive explanatory variables are all continuous variables. The dependent variable (Y) is also a continuous variable. 

The unbalanced panel data structure looks like this:

Year       gvkey    Company            Time      SIC         X1          Y             X2

1997       599902 ABC                      1             2835       0.0336   0.4038   114.1900

1998       599902 ABC                      2             2835                     0.3493   510.3800

1999       599902 ABC                      3             2835     -0.0544   0.3503   

2000       599902 ABC                      4             2835     -0.1056                 400.5750

2001       599902 ABC                      5             2835     -0.0807   0.0942   579.5100

.

.

1997       92276HDEF                        1              2840      0.1164   0.6682   7.9570

1998       92276HDEF                        2             2840       0.1554   0.1705   7.0780

1999       92276HDEF                        3             2840       0.0172   0.2500   11.1160

2000       92276HDEF                        4             2840                     0.0544   14.9290

2001       92276HDEF                        5             2840       0.0994   0.0258   

.

.

Here are my questions:-

(1) I would like to run the 2SLS test to control for endogeneity problem related to one of the explanatory variables.  Could anyone please provide the appropriate SAS codes to run the 2SLS procedure in the context of this study?

(2) How do I know whether I have a strong or weak instrument?  What sensitivity test do I use to check for the validity of the instruments?  I would appreciate having the SAS codes to test for instrumental validity.

(3) Given the nature of my panel data, how do I obtain robust or heteroscedasticity corrected standard errors? What SAS codes do I use?

Thank you so much in advance for any help you can offer.

Super User
Super User
Posts: 6,153

Heckman's 2-stage least squares in SAS

Do you have SAS/ETS?  Try PROC SYSLIN.

Occasional Contributor
Posts: 9

Heckman's 2-stage least squares in SAS

Thanks, Tom, for your suggestion.  I did think about using either PROC SYSLIN or PROC MODEL.  However, I was told by someone well-versed in SAS that both of these procedures are not designed for panel data.  Mine is an unbalanced panel data. Do you know of any way to get around this problem?  Additionally, do you know if PROC SYSLIN could generate heteroscedasticity corrected standard errors?  If so, how?  Thanks so much in advance!

Frequent Contributor
Posts: 129

Heckman's 2-stage least squares in SAS

Several ETS modules can do 2SLS - search for 2SLS in help.

But do you have a suitable instrument? You cannot test the validity of an instrument - this must come from theory. (If you have more than on instrument you can do a test that can reject the hypothesis that they are all valid instruments, but this is only a limited test of validity).

A valid instrument must

- be correlated with CEO stock options (the F or R2 of this equation is a simple test of the instrument strength), and

- not have any causal association with risk-taking, except via this association with CEO stock options.

The second requirement is usually quite challenging.

Re heteroscedasticity, there are a few options. This excerpt from the proc model help might help get you started.

"Note that White’s test in the MODEL procedure is different than White’s test in the REG procedure requested by the SPEC option. The SPEC option produces the test from Theorem 2 on page 823 of White (1980). The WHITE option, on the other hand, produces the statistic discussed in Greene (1993). "

Occasional Contributor
Posts: 9

Heckman's 2-stage least squares in SAS

Thanks so much, BruceBrad, for your insight!  Yes, I do have two instruments for CEO options.  My understanding is that in PROC SYSLIN, I can asses the validity of my instrument by (1) checking the F or R2 in the first stage, and (2) conducting an overidentifying restriction test.  Question: (1) Do you know if both of these tests are available in PROC MODEL?  I've read some materials on PROC MODEL but I can't seem to find stuff on how this procedure tests for validity of instrumental variables.

Re heteroskedasticity - I've looked at PROC MODEL and PROC SYSLIN in the SAS manual.  According to the manual, "The MODEL procedure analyzes models in which the relationships among the variables comprise a system of one or more nonlinear equations."  My understanding is that PROC SYSLIN analyzes linear equations. I am analyzing linear equations in my models, so it seems that PROC SYSLIN would be the appropriate procedure.  However, as indicated in my response to Tom, someone has told me that PROC MODEL and PROC SYSLIN are not designed for panel data. I have unbalanced panel data. So here are my questions:

(2) Is there a way for me to use PROC MODEL or PROC SYSLIN to run my unbalanced panel data? 

Assuming the answer to (2) is yes,

(3) I have linear equations in my model. Can I use PROC MODEL instead of PROC SYSLIN?

(4) Is there something similar akin to the White test in PROC SYSLIN? 

Thank you in advance for your help!

Frequent Contributor
Posts: 129

Heckman's 2-stage least squares in SAS

Can't answer all your questions, but the following might help:

- Proc model can do just about everything that syslin can (ie it does non-linear models as well as linear models). The main difference is that Syslin has simpler syntax.

- I think your panel data model is a fixed effects model. These can be calculated in several ways (other than using proc panel or glm absorb). Eg by actually including a dummy variable for each fixed effect (eg firm) or by transforming the data so they are deviations from within-firm means. You should look at textbook like Wooldridge's "Econometric Analysis of Cross Sectional and Panel data" for an explanation of this (I just googled it, there seems to be a PDF available via google scholar). The first of these methods (maybe both) will work with unbalanced panel data, and then you use proc model or syslin to do the 2sls.

- Overidentifying test. I've never done this (finding one valid instrument is hard enough, let alone two). The idea is that it tests whether both instruments give the same result. You might be able to test it by similtaneously estimating two equations (with differrent instruments in each) and then testing for equality of coefficients - but I'm just speculating here.

- Wooldridge refers to a method by Arellano to calculate robust standard errors for panel data, but I don't think is available in any canned routine.

Ask a Question
Discussion stats
  • 5 replies
  • 3836 views
  • 0 likes
  • 3 in conversation