********************************************; * PROGRAM: AceAng2000_Table5 ; * PROGRAMMER: Simone Schaner ; * DATE CREATED: 8/9/07 ; * PURPOSE: Creates Table 5 of Acemoglu and ; * Angrist (2000) ; * NOTES: Transcribed from original code ; ********************************************; libname mylib '/bbkinghome/sschaner/Angrist Work/Web Papers/AcemogluAngrist_2000/v9data/'; options ls=80 nocenter; filename moulton3 '/bbkinghome/sschaner/Angrist Work/Web Papers/AcemogluAngrist_2000/SAS programs/moulton3.sas'; * INSTRUMENT SETS; %macro qobset; qob401 qob402 qob403 qob411 qob412 qob413 qob421 qob422 qob423 qob431 qob432 qob433 qob441 qob442 qob443 qob451 qob452 qob453 qob461 qob462 qob463 qob471 qob472 qob473 qob481 qob482 qob483 qob491 qob492 qob493 %mend; %macro clset; cl7 cl8 cl9 %mend; %macro caset; ca9 ca10 ca11 %mend; %macro y6080; 96 le year le 98; %mend; %macro y80; year=98; %mend; %macro y6070; year=97 | year=96; %mend; %macro y6090; 96 le year le 99; %mend; %macro y5080; 95 le year le 98; %mend; %macro y5090; 95 le year le 99; %mend; %macro tit1; title 'QOB Instruments'; %mend; %macro tit2; title 'SOB-CL Instruments'; %mend; %macro tit3; title 'SOB-CA Instruments'; %mend; %macro sor1; title2 'Including SOR'; %mend; %macro sor2; title2 'Excluding SOR'; %mend; %macro cont1; yob1-yob50 sor1-sor55 sob1-sob55 %mend; %macro cont2; yob1-yob50 sob1-sob55 %mend; data ten; /*THE CODE FOR Table6_0 CREATES "defin" DATASET*/ set mylib.defin (drop=yob10-yob54); * EXCLUSIONS; if (40<=age<=50); if lnwkwage ne .; if 95 le year le 99; if (havecsl=1 and newsampl=1); * HAVE TO REDO YEAR OF BIRTH DUMMIES; array yobs(50) yob1-yob50; do j=1 to 50; index=1899+j; yobs(j)=(yob=index); end; *** constructing the 30 quarter-of-birth/year-of-birth dummies ***********; qob401 = qtr1 * ((yob10=1) or (yob20=1) or (yob30=1)); qob402 = qtr2 * ((yob10=1) or (yob20=1) or (yob30=1)); qob403 = qtr3 * ((yob10=1) or (yob20=1) or (yob30=1)); qob411 = qtr1 * ((yob11=1) or (yob21=1) or (yob31=1)); qob412 = qtr2 * ((yob11=1) or (yob21=1) or (yob31=1)); qob413 = qtr3 * ((yob11=1) or (yob21=1) or (yob31=1)); qob421 = qtr1 * ((yob12=1) or (yob22=1) or (yob32=1)); qob422 = qtr2 * ((yob12=1) or (yob22=1) or (yob32=1)); qob423 = qtr3 * ((yob12=1) or (yob22=1) or (yob32=1)); qob431 = qtr1 * ((yob13=1) or (yob23=1) or (yob33=1)); qob432 = qtr2 * ((yob13=1) or (yob23=1) or (yob33=1)); qob433 = qtr3 * ((yob13=1) or (yob23=1) or (yob33=1)); qob441 = qtr1 * ((yob14=1) or (yob24=1) or (yob34=1)); qob442 = qtr2 * ((yob14=1) or (yob24=1) or (yob34=1)); qob443 = qtr3 * ((yob14=1) or (yob24=1) or (yob34=1)); qob451 = qtr1 * ((yob15=1) or (yob25=1) or (yob35=1)); qob452 = qtr2 * ((yob15=1) or (yob25=1) or (yob35=1)); qob453 = qtr3 * ((yob15=1) or (yob25=1) or (yob35=1)); qob461 = qtr1 * ((yob16=1) or (yob26=1) or (yob36=1)); qob462 = qtr2 * ((yob16=1) or (yob26=1) or (yob36=1)); qob463 = qtr3 * ((yob16=1) or (yob26=1) or (yob36=1)); qob471 = qtr1 * ((yob17=1) or (yob27=1) or (yob37=1)); qob472 = qtr2 * ((yob17=1) or (yob27=1) or (yob37=1)); qob473 = qtr3 * ((yob17=1) or (yob27=1) or (yob37=1)); qob481 = qtr1 * ((yob18=1) or (yob28=1) or (yob38=1)); qob482 = qtr2 * ((yob18=1) or (yob28=1) or (yob38=1)); qob483 = qtr3 * ((yob18=1) or (yob28=1) or (yob38=1)); qob491 = qtr1 * ((yob19=1) or (yob29=1) or (yob39=1)); qob492 = qtr2 * ((yob19=1) or (yob29=1) or (yob39=1)); qob493 = qtr3 * ((yob19=1) or (yob29=1) or (yob39=1)); run; %macro makeregs(where,insts,title,sor,controls,kval); proc syslin 2sls out=test2 data=ten; %&title; %&sor; title3 'Including SoR'; endogenous gradca99 lnwkwage; weight slwt; where %&where; instruments %&controls %&insts; model lnwkwage= %&controls gradca99; output r=v_ij; run; %mend; **** MOULTON ADJUSTMENTS ****; data test2; set test2; v_ij= v_ij*sqrt(slwt); %let step=1; %let k=&kval; %let randvar= clusid; %include moulton3; proc datasets; delete test2; run; proc reg data=ten; weight slwt; where %&where; model gradca99 = %&controls %&insts /noprint; output out=test2b p=p_gracap; proc reg data=test2b; weight slwt; where %&where; model p_gracap = %&controls /noprint; output out=test2 r=v_ij; data test2; set test2; v_ij=v_ij*sqrt(slwt); %let step=2; %let k=&kval.-1; %let randvar=clusid; %include moulton3; proc summary data=ten; by clusid; where %&where; var lnwkwage; output out=sizeds n=size; proc summary data=sizeds; var size; output out=sizeds mean=m var=v; data calc; merge ds1 ds2 sizeds; drop dummy _type_; gfac=sqrt(1+(((v/m)+(m-1))*rho2*rho1)); proc print; %&title; %&sor; title3 'moulton correction factors - OLS'; run; **** END MOULTON CORRECTION ****; %mend; %makeregs(y6080,qobset,tit1,sor1,cont1,127); %makeregs(y6080,qobset,tit1,sor2,cont2,79); %makeregs(y80,qobset,tit1,sor1,cont1,107); %makeregs(y80,qobset,tit1,sor2,cont2,59); %makeregs(y6070,qobset,tit1,sor1,cont1,117); %makeregs(y6070,qobset,tit1,sor2,cont2,69); %makeregs(y6080,clset,tit2,sor1,cont1,127); %makeregs(y6080,clset,tit2,sor2,cont2,79); %makeregs(y5080,clset,tit2,sor1,cont1,137); %makeregs(y5080,clset,tit2,sor2,cont2,89); %makeregs(y5090,clset,tit2,sor1,cont1,147); %makeregs(y5090,clset,tit2,sor2,cont2,99); %makeregs(y6080,caset,tit3,sor1,cont1,127); %makeregs(y6080,caset,tit3,sor2,cont2,79); %makeregs(y5080,caset,tit3,sor1,cont1,137); %makeregs(y5080,caset,tit3,sor2,cont2,89); %makeregs(y5090,caset,tit3,sor1,cont1,147); %makeregs(y5090,caset,tit3,sor2,cont2,99);