## How to do instrumental variables analysis in SAS?

Occasional Contributor
Posts: 16

# How to do instrumental variables analysis in SAS?

Hi guys,

How to do instrumental variables analysis in SAS? I Just find STATA  software can do it  with IVREGRESS  procedure. Is there any specified STAT procedure can do that in SAS?

If there is no such a procedure, how to do it with several data steps or  procedures?  Any examples?

Thanks a lot!

Hongqiu

Posts: 2,655

## Re: How to do instrumental variables analysis in SAS?

Look at PROC MODEL and PROC SYSLIN in the SAS/ETS documentation, and PROC CALIS in the SAS/STAT documentation.  There should be examples for each of these (maybe more than you want, as PROC MODEL and PROC CALIS are very versatile in what they can do).

Steve Denham

Occasional Contributor
Posts: 16

## Re: How to do instrumental variables analysis in SAS?

Thanks for your suggestion. I'll find more details from documents.

Hongqiu

SAS Employee
Posts: 89

## Re: How to do instrumental variables analysis in SAS?

As Steve mentioned, PROC SYSLIN or PROC MODEL are the easiest ways to estimate a regression using two-stage least squares.  Here is an example:

There are also more examples at SAS/ETS 13.1 User's Guide Example Programs

data in;

label q = "Quantity"

p = "Price"

s = "Price of Substitutes"

y = "Income"

u = "Unit Cost";

drop i e1 e2;

p = 0; q = 0;

do i = 1 to 60;

y = 1 + .05*i + .15*rannor(123);

u = 2 + .05*rannor(123) + .05*rannor(123);

s = 4 - .001*(i-10)*(i-110) + .5*rannor(123);

e1 = .15 * rannor(123);

e2 = .15 * rannor(123);

demandx = 1 + .3 * y + .35 * s + e1;

supplyx = -1 - 1 * u + e2 - .4*e1;

q = 1.4/2.15 * demandx + .75/2.15 * supplyx;

p = ( - q + supplyx ) / -1.4;

output;

end;

run;

/*-- OLS Estimation --*/

proc syslin data=in;

demand: model q = p y s;

supply: model q = p u;

run;

/*-- Two-Stage Least Squares Estimation --*/

proc syslin data=in 2sls;

endogenous p;

instruments y u s;

demand: model q = p y s;

supply: model q = p u;

run;

Occasional Contributor
Posts: 16