Software

Computing Clustered Standard Errors for Two-Stage Least Squares in SAS

Tanguy Brachet, University of Pennsylvania

Abstract

Since SAS doesn't offer a 2SLS procedure that allows for clustered standard errors, this macro develops an equivalent algorithm based on SAS's available procedures. The steps are as follows: [1] estimate the first stage by OLS and save the endogenous variable's predicted values (PROC REG); [2] estimate the structural equation as usual and save the 2SLS residuals (PROC SYSLIN); [3] merge the dataset containing the first stage predictions with that containing the 2SLS residuals; [4] regress the 2SLS residuals on the 1st stage predicted values and all other exogenous variables, clustering the standard errors by the cluster variable (PROC SURVEYREG). The standard errors reported in step [4] are the clustered 2SLS standard errors.

Suggested Citation

Tanguy Brachet. "Computing Clustered Standard Errors for Two-Stage Least Squares in SAS" 2007
Available at: http://works.bepress.com/tbrachet/2