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
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
Thanks for your suggestion. I'll find more details from documents.
Hongqiu
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;
Thanks for your help. That quit helpful!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.