*********************************************************************************; * Prepare data *********************************************************************************; /*Pre-sorting dataset*/ data all_t; set nimf.all_t; where GCB_Y_Tm1_T ne . and BCA_Y_Tm1_T ne . and GCB_Y_Tm2_Tm1 ne . and BCA_Y_Tm2_Tm1 ne . and GCB_Y_Tm3_Tm2 ne . and BCA_Y_Tm3_Tm2 ne . and GCB_Y_Tm1 ne . and BCA_Y_Tm1 ne . and industrial=0 ; if Year<1993 then delete; if Year>2002 then delete; /*Eliminating countries with small population (less than 1 million in 1993)*/ /*if Country='Antigua and Barbuda' then delete; if Country='Bahamas, The' then delete; if Country='Bahrain, Kingdom of' then delete; if Country='Barbados' then delete; if Country='Belize' then delete; if Country='Bhutan' then delete; if Country='Brunei Darussalam' then delete; if Country='Cape Verde' then delete; if Country='Comoros' then delete; if Country='Cyprus' then delete; if Country='Djibouti' then delete; if Country='Dominica' then delete; if Country='Equatorial Guinea' then delete; if Country='Fiji' then delete; if Country='Grenada' then delete; if Country='Guyana' then delete; if Country='Iceland' then delete; if Country='Kiribati' then delete; if Country='Luxembourg' then delete; if Country='Maldives' then delete; if Country='Malta' then delete; if Country='Netherlands Antilles' then delete; if Country='Qatar' then delete; if Country='Samoa' then delete; if Country='São Tomé & Príncipe' then delete; if Country='Seychelles' then delete; if Country='Solomon Islands' then delete; if Country='St. Kitts and Nevis' then delete; if Country='St. Lucia' then delete; if Country='St. Vincent & Grens.' then delete; if Country='Suriname' then delete; if Country='Swaziland' then delete; if Country='Tonga' then delete; if Country='Vanuatu' then delete;*/ /*Overlap sorting*/ if project=. then output; if project=0 then output; /*if project=-4 then output; if project=4 then output*/; run; data all_t; set all_t; if project=. then program=0; /* program=0 - no program*/ if project=0 then program=1; /* program=1 - there is a program*/ run; /*Computing deltas*/ data all_t; set all_t; BCA_Y_Tm1_Tp1 = BCA_Y_Tp1 - BCA_Y_Tm1; GCB_Y_Tm1_Tp1 = GCB_Y_Tp1 - GCB_Y_Tm1; GROWTH_RPC_Tm1_Tp1 = GROWTH_RPC_Tp1 - GROWTH_RPC_Tm1; BCA_Y_Tm3_Tm1 = BCA_Y_Tm1 - BCA_Y_Tm3; GCB_Y_Tm3_Tm1 = GCB_Y_Tm1 - GCB_Y_Tm3; GROWTH_RPC_Tm3_Tm1 = GROWTH_RPC_Tm1 - GROWTH_RPC_Tm3; BCA_Y_Tm1_Tp2 = BCA_Y_Tp2 - BCA_Y_Tm1; GCB_Y_Tm1_Tp2 = GCB_Y_Tp2 - GCB_Y_Tm1; GROWTH_RPC_Tm1_Tp2 = GROWTH_RPC_Tp2 - GROWTH_RPC_Tm1; BCA_Y_Tm4_Tm1 = BCA_Y_Tm1 - BCA_Y_Tm4; GCB_Y_Tm4_Tm1 = GCB_Y_Tm1 - GCB_Y_Tm4; GROWTH_RPC_Tm4_Tm1 = GROWTH_RPC_Tm1 - GROWTH_RPC_Tm4; BCA_Y_Tm1_Tp3 = BCA_Y_Tp3 - BCA_Y_Tm1; GCB_Y_Tm1_Tp3 = GCB_Y_Tp3 - GCB_Y_Tm1; GROWTH_RPC_Tm1_Tp3 = GROWTH_RPC_Tp3 - GROWTH_RPC_Tm1; BCA_Y_Tm5_Tm1 = BCA_Y_Tm1 - BCA_Y_Tm5; GCB_Y_Tm5_Tm1 = GCB_Y_Tm1 - GCB_Y_Tm5; GROWTH_RPC_Tm5_Tm1 = GROWTH_RPC_Tm1 - GROWTH_RPC_Tm5; run; *********************************************************************************; * IV Technique *********************************************************************************; ods html frame="glmex.html" body="glmexb.html" contents="glmexc.html"; /*Based on code from: */ /*http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0204b&L=sas-l&F=&S=&P=39988 Date: Thu, 11 Apr 2002 12:14:52 -0700 Reply-To: Matthias Kehder Sender: "SAS(r) Discussion" Comments: To: SAS-L@vt.edu, delane.botelho@marshall.usc.edu From: Matthias Kehder Subject: Re: Tobit model by Heckman two stage estimator Comments: To: SAS-L@LISTSERV.VT.EDU In-Reply-To: Content-Type: text/plain; name="HECKMAN.TXT" /* This macro is supported by the author (see below), not by SAS Institute. */ options noovp linesize=75; title 'Two-Step IV Estimation Procedure'; /* Use: The code requires very little modification. Change the variable names in the macro declarations that appear after this introduction to reflect the names of the dependent and independent variables in the first (probit) and second (OLS) stages of the estimation. If your selection criterion is different, modify the values of the macros %slct and %nonslct as well (it is unlikely that you'll want to do this), and possibly the sort before the probit. Modify the first DATA step (where dataset a is created) to access your data. The rest of the program should be left unchanged. *****************************************************************/ /******************************************************************/ /* Macros */ /* */ /* While you may be unfamiliar with SAS macros, their use here */ /* allows you not to modify any of estimation code that follows */ /* slct: value of the selection variable that indicates the */ /* "selected" sample. Usually this is "1", as below, */ /* but you may want to modify it. */ %macro slct; 1 %mend slct; /* nonslct: value of the selection variable that indicates the */ /* "unselected" sample. Usually this is "0", as below */ /* but you may want to modify it. */ %macro nonslct; 0 %mend nonslct; /* prbtlhs: dependent variable for first stage (probit) */ /* replace "sel" below with your variable */ %macro prbtlhs; program %mend prbtlhs; /* prbtrhs: independent variables for first stage (probit) */ /* replace "x1" below with your variable(s) */ /* you can use more than one line for them */ %macro prbtrhs; GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm3_Tm2 BCA_Y_Tm3_Tm2 GROWTH_RPC_Tm3_Tm2 GCB_Y_Tm1 BCA_Y_Tm1 GROWTH_RPC_Tm1 t_91 t_92 t_93 t_94 t_95 t_96 t_97 t_98 t_99 t_00 t_01 t_02 last10yr %mend prbtrhs; /* Modify this DATA step to access your data. */ /* Do _not_ change the name of dataset a */ /* The KEEP option keeps only variables that will be used in */ /* the estimation procedure; it may be deleted if so desired */ data a /*(keep=%prbtlhs %prbtrhs %olslhs %olsrhs)*/; set all_t; /* if you already have a */ /* SAS data set, created */ /* you'll need a SET */ /* statement */ /***************************************************************/ /* You shouldn't need to modify anything below this point */ /***************************************************************/ /* need to sort data to get coefficients with right signs */ proc sort data=a; by descending %prbtlhs; /***** First Stage: Probit *****/ /* note use of order=data to get coefficients with right signs */ /* will save predicted gammaw's to dataset imr for calculation of inverse mills ratio; note that all variables from dataset a will also be saved in dataset imr */ proc probit order=data ; class %prbtlhs; model %prbtlhs=%prbtrhs / covb; output out=imr p=propensity_hat xbeta=gammaw; title2 'First Stage: Probit Estimates of Selection'; run; quit; data imr; /*quality of prediction*/ set imr; program_hat=1; if propensity_hat<0.5 then program_hat=0; run; proc freq data=imr; /*quality of prediction*/ tables program*program_hat; run; data imr; /*to ensure that I have all T's for the same countries*/ set imr; where BCA_Y_Tm1_Tp1 ne . and GCB_Y_Tm1_Tp1 ne . and GROWTH_RPC_Tm1_Tp1 ne . and BCA_Y_Tm3_Tm1 ne . and GCB_Y_Tm3_Tm1 ne . and GROWTH_RPC_Tm3_Tm1 ne . and BCA_Y_Tm1_Tp2 ne . and GCB_Y_Tm1_Tp2 ne . and GROWTH_RPC_Tm1_Tp2 ne . and BCA_Y_Tm4_Tm1 ne . and GCB_Y_Tm4_Tm1 ne . and GROWTH_RPC_Tm4_Tm1 ne . and BCA_Y_Tm1_Tp3 ne . and GCB_Y_Tm1_Tp3 ne . and GROWTH_RPC_Tm1_Tp3 ne . and BCA_Y_Tm5_Tm1 ne . and GCB_Y_Tm5_Tm1 ne . and GROWTH_RPC_Tm5_Tm1 ne . ; run; /* Next we create the Inverse Mills' Ratio */ data imr; set imr; /* create inverse mills ratio */ if (%prbtlhs eq %slct) then /*denominator is "turned off" because we run it on both 0's and 1's*/ lambda=(1/sqrt(2*3.141592654)*exp(-1*gammaw**2/2)) /* /probnorm(gammaw)*/; else if (%prbtlhs eq %nonslct) then lambda=(1/sqrt(2*3.141592654)*exp(-1*gammaw**2/2)) /* /(probnorm(gammaw)-1) */; else lambda=.; run; ***********************************************; ***********************************************; ***********************************************; /***** IV Second Stage: OLS Current Account *****/ ***********************************************; /* olslhs: dependent variable for second stage (ols) */ /* replace "dep" below with your variable */ title2 'IV Second Stage: OLS Estimates of Model (Horion T)'; %macro olslhs; BCA_Y_Tm1_T %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'IV Second Stage: OLS Estimates of Model (Horion T+1)'; %macro olslhs; BCA_Y_Tm1_Tp1 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm3_Tm1 GCB_Y_Tm3_Tm1 BCA_Y_Tm3_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'IV Second Stage: OLS Estimates of Model (Horion T+2)'; %macro olslhs; BCA_Y_Tm1_Tp2 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm4_Tm1 GCB_Y_Tm4_Tm1 BCA_Y_Tm4_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'Second Stage: OLS Estimates of Model (Horion T+3)'; %macro olslhs; BCA_Y_Tm1_Tp3 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm5_Tm1 GCB_Y_Tm5_Tm1 BCA_Y_Tm5_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; ***********************************************; /***** IV Second Stage: OLS Fiscal Balance *****/ ***********************************************; /* olslhs: dependent variable for second stage (ols) */ /* replace "dep" below with your variable */ title2 'IV Second Stage: OLS Estimates of Model (Horion T)'; %macro olslhs; GCB_Y_Tm1_T %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_T */ GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'Second Stage: OLS Estimates of Model (Horion T+1)'; %macro olslhs; GCB_Y_Tm1_Tp1 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_Tp1 */ GROWTH_RPC_Tm3_Tm1 GCB_Y_Tm3_Tm1 BCA_Y_Tm3_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'Second Stage: OLS Estimates of Model (Horion T+2)'; %macro olslhs; GCB_Y_Tm1_Tp2 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_Tp2 */ GROWTH_RPC_Tm4_Tm1 GCB_Y_Tm4_Tm1 BCA_Y_Tm4_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'Second Stage: OLS Estimates of Model (Horion T+3)'; %macro olslhs; GCB_Y_Tm1_Tp3 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_Tp3 */ GROWTH_RPC_Tm5_Tm1 GCB_Y_Tm5_Tm1 BCA_Y_Tm5_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; ***********************************************; /***** IV Second Stage: OLS Economic Growth *****/ ***********************************************; /* olslhs: dependent variable for second stage (ols) */ /* replace "dep" below with your variable */ title2 'IV Second Stage: OLS Estimates of Model (Horion T)'; %macro olslhs; GROWTH_RPC_Tm1_T %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'IV Second Stage: OLS Estimates of Model (Horion T+1)'; %macro olslhs; GROWTH_RPC_Tm1_Tp1 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm3_Tm1 GCB_Y_Tm3_Tm1 BCA_Y_Tm3_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'IV Second Stage: OLS Estimates of Model (Horion T+2)'; %macro olslhs; GROWTH_RPC_Tm1_Tp2 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm4_Tm1 GCB_Y_Tm4_Tm1 BCA_Y_Tm4_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; title2 'Second Stage: OLS Estimates of Model (Horion T+3)'; %macro olslhs; GROWTH_RPC_Tm1_Tp3 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm5_Tm1 GCB_Y_Tm5_Tm1 BCA_Y_Tm5_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda propensity_hat /*program_hat*/; output out=err residual=e; run; quit; ***********************************************; ***********************************************; /* Censored-Sample Approach */ ***********************************************; ***********************************************; ***********************************************; /***** Second Stage: OLS Current Account *****/ ***********************************************; /* olslhs: dependent variable for second stage (ols) */ /* replace "dep" below with your variable */ title2 'Censored-Sample: OLS Estimates of Model (Horion T)'; %macro olslhs; BCA_Y_Tm1_T %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+1)'; %macro olslhs; BCA_Y_Tm1_Tp1 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm3_Tm1 GCB_Y_Tm3_Tm1 BCA_Y_Tm3_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+2)'; %macro olslhs; BCA_Y_Tm1_Tp2 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm4_Tm1 GCB_Y_Tm4_Tm1 BCA_Y_Tm4_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+3)'; %macro olslhs; BCA_Y_Tm1_Tp3 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm5_Tm1 GCB_Y_Tm5_Tm1 BCA_Y_Tm5_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; ***********************************************; /***** Censored-Sample: OLS Fiscal Balance *****/ ***********************************************; /* olslhs: dependent variable for second stage (ols) */ /* replace "dep" below with your variable */ title2 'Censored-Sample: OLS Estimates of Model (Horion T)'; %macro olslhs; GCB_Y_Tm1_T %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_T */ GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+1)'; %macro olslhs; GCB_Y_Tm1_Tp1 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_Tp1 */ GROWTH_RPC_Tm3_Tm1 GCB_Y_Tm3_Tm1 BCA_Y_Tm3_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+2)'; %macro olslhs; GCB_Y_Tm1_Tp2 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_Tp2 */ GROWTH_RPC_Tm4_Tm1 GCB_Y_Tm4_Tm1 BCA_Y_Tm4_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+3)'; %macro olslhs; GCB_Y_Tm1_Tp3 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; /*BCA_Y_Tm1_Tp3 */ GROWTH_RPC_Tm5_Tm1 GCB_Y_Tm5_Tm1 BCA_Y_Tm5_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; ***********************************************; /***** Censored-Sample: OLS Economic Growth *****/ ***********************************************; /* olslhs: dependent variable for second stage (ols) */ /* replace "dep" below with your variable */ title2 'Censored-Sample: OLS Estimates of Model (Horion T)'; %macro olslhs; GROWTH_RPC_Tm1_T %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm2_Tm1 GCB_Y_Tm2_Tm1 BCA_Y_Tm2_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+1)'; %macro olslhs; GROWTH_RPC_Tm1_Tp1 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm3_Tm1 GCB_Y_Tm3_Tm1 BCA_Y_Tm3_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+2)'; %macro olslhs; GROWTH_RPC_Tm1_Tp2 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm4_Tm1 GCB_Y_Tm4_Tm1 BCA_Y_Tm4_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; title2 'Censored-Sample: OLS Estimates of Model (Horion T+3)'; %macro olslhs; GROWTH_RPC_Tm1_Tp3 %mend olslhs; /* olsrhs: independent variables for second stage (ols) */ /* replace "x2" below with your variable(s) */ /* you can use more than one line for them */ %macro olsrhs; GROWTH_RPC_Tm5_Tm1 GCB_Y_Tm5_Tm1 BCA_Y_Tm5_Tm1 GROWTH_RPC_Tm1 GCB_Y_Tm1 BCA_Y_Tm1 %mend olsrhs; proc reg data=imr outest=olsest; model %olslhs=%olsrhs lambda program; output out=err residual=e; run; quit; ***********************************************; ***********************************************; /*info on estimated propensity scores*/ ***********************************************; ***********************************************; proc univariate data=imr; where program =1; /*program countries*/ title 'Propensity Score for Program Countries'; var propensity_hat; qqplot propensity_hat/ PCTLSCALE; /*constracting CDF*/ run; proc univariate data=imr; where program =1; /*program countries*/ var propensity_hat; histogram propensity_hat /normal cbarline=grey midpoints=0 to 1 by .01; title 'Propensity for Program Countries'; run; proc univariate data=imr; where program =0; /*non-program countries*/ title 'Propensity Score for Non-Program Countries'; var propensity_hat; qqplot propensity_hat/ PCTLSCALE; /*constracting CDF*/ run; proc univariate data=imr; where program =0; /*non-program countries*/ var propensity_hat; histogram propensity_hat /normal cbarline=grey midpoints=0 to 1 by .01; title 'Propensity for Non-Program Countries'; run; ********************************************************************; ********************************************************************; ********************************************************************; ********************************************************************; ********************************************************************; ********************************************************************; /* Matching Technique */ ********************************************************************; ********************************************************************;*/ title 'Matching Technique'; data case; /*dataset of only countries WITH programs*/ set imr; where program=1; run; data control; /*dataset of only countries WITHOUT programs*/ set imr; where program=0; run; %MACRO MATCH(CASE=,CONTROL=,IDCA=,IDCO=, MVARS=,WTS=,DMAXK=,DMAX=, NCONTLS=, TIME=, METHOD=,SEEDCA=,SEEDCO=,MAXITER=100000, PRINT=y, OUT=__OUT, /*data set with matched cases*/ OUTNMCA=__NMCA, /*data set with NON-matched cases*/ OUTNMCO=__NMCO, /*data set with NON-matched controls*/ MINCONT=,MAXCONT=); %LET BAD=0; %IF %LENGTH(&CASE)=0 %THEN %DO; %PUT ERROR: NO CASE DATASET SUPPLIED; %LET BAD=1; %END; %IF %LENGTH(&CONTROL)=0 %THEN %DO; %PUT ERROR: NO CONTROL DATASET SUPPLIED; %LET BAD=1; %END; %IF %LENGTH(&IDCA)=0 %THEN %DO; %PUT ERROR: NO IDCA VARIABLE SUPPLIED; %LET BAD=1; %END; %IF %LENGTH(&IDCO)=0 %THEN %DO; %PUT ERROR: NO IDCO VARIABLE SUPPLIED; %LET BAD=1; %END; %IF %LENGTH(&MVARS)=0 %THEN %DO; %PUT ERROR: NO MATCHING VARIABLES SUPPLIED; %LET BAD=1; %END; %IF %LENGTH(&WTS)=0 %THEN %DO; %PUT ERROR: NO WEIGHTS SUPPLIED; %LET BAD=1; %END; %IF %UPCASE(&METHOD)=GREEDY %THEN %DO; %IF %LENGTH(&SEEDCA)=0 %THEN %DO; %PUT ERROR: NO SEEDCA VALUE SUPPLIED; %LET BAD=1; %END; %IF %LENGTH(&SEEDCO)=0 %THEN %DO; %PUT ERROR: NO SEEDCO VALUE SUPPLIED; %LET BAD=1; %END; %END; %IF %LENGTH(&OUT)=0 %THEN %DO; %PUT ERROR: NO OUTPUT DATASET SUPPLIED; %LET BAD=1; %END; %IF %UPCASE(&METHOD)^=GREEDY & %UPCASE(&METHOD)^=OPTIMAL %THEN %DO; %PUT ERROR: METHOD MUST BE GREEDY OR OPTIMAL; %LET BAD=1; %END; %IF (&MINCONT= AND &MAXCONT^= ) OR (&MINCONT^= AND &MAXCONT= ) %THEN %DO; %PUT ERROR: MINCONT AND MAXCONT MUST BOTH BE SPECIFIED; %LET BAD=1; %END; %LET NVAR=0; %DO %UNTIL(%SCAN(&MVARS,&NVAR+1,' ')= ); %LET NVAR=%EVAL(&NVAR+1); %END; %LET NWTS=0; %DO %UNTIL(%QSCAN(&WTS,&NWTS+1,' ')= ); %LET NWTS=%EVAL(&NWTS+1); %END; %IF &NVAR^= &NWTS %THEN %DO; %PUT ERROR: #VARS MUST EQUAL #WTS; %LET BAD=1; %END; %LET NK=0; %IF %QUOTE(&DMAXK)^= %THEN %DO %UNTIL(%QSCAN(&DMAXK,&NK+1,' ')= ); %LET NK=%EVAL(&NK+1); %END; %IF &NK>&NVAR %THEN %LET NK=&NVAR; %DO I=1 %TO &NVAR; %LET V&I=%SCAN(&MVARS,&I,' '); %END; %IF &NWTS>0 %THEN %DO; DATA _NULL_; %DO I=1 %TO &NWTS; %LET W&I=%SCAN(&WTS,&I,' '); IF &&W&I<0 THEN DO; PUT 'ERROR: WEIGHTS MUST BE NON-NEGATIVE'; CALL SYMPUT('BAD','1'); END; %END; RUN; %END; %IF &NK>0 %THEN %DO; DATA _NULL_; %DO I=1 %TO &NK; %LET K&I=%SCAN(&DMAXK,&I,' '); IF &&K&I<0 THEN DO; PUT 'ERROR: DMAXK VALUES MUST BE NON-NEGATIVE'; CALL SYMPUT('BAD','1'); END; %END; RUN; %END; %MACRO DIJ; %DO I=1 %TO &NVAR-1; &&W&I*ABS(__CA&I-__CO&I) + %END; &&W&NVAR*ABS(__CA&NVAR-__CO&NVAR); %MEND DIJ; %MACRO MAX1; %IF &DMAX^= %THEN %DO; & __D<=&DMAX %END; %DO I=1 %TO &NK; & ABS(__CA&I-__CO&I)<=&&K&I %END; %MEND MAX1; %MACRO MAX2; %IF &DMAX= & &NK=0 %THEN %DO; %IF &time^= %then %do; if __cotime>__catime then %end; output; %end; %IF &DMAX^= & &NK=0 %THEN %DO; IF _COST_<=&DMAX %if &time^= %then %do; & __cotime>__catime %end; THEN OUTPUT; %END; %IF &DMAX= & &NK>0 %THEN %DO; IF ABS(__CA1-__CO1)<=&K1 %DO I=2 %TO &NK; & ABS(__CA&I-__CO&I)<=&&K&I %END; %if &time^= %then %do; & __cotime>__catime %end; THEN OUTPUT; %END; %IF &DMAX^= & &NK>0 %THEN %DO; IF _COST_<=&DMAX %DO I=1 %TO &NK; & ABS(__CA&I-__CO&I)<=&&K&I %END; %if &time^= %then %do; & __cotime>__catime %end; THEN OUTPUT; %END; %MEND MAX2; %MACRO LBLS; %DO I=1 %TO &NVAR; __CA&I="&&V&I/CASE" __CO&I="&&V&I/CONTROL" __DIF&I="&&V&I/ABS. DIFF " __WT&I="&&V&I/WEIGHT" %END; %MEND LBLS; %MACRO VBLES; %DO I=1 %TO &NVAR; __DIF&I %END; %DO I=1 %TO &NVAR; __CA&I __CO&I %END; %MEND VBLES; %MACRO GREEDY; %GLOBAL BAD2; DATA __CASE; SET &CASE; %DO I=1 %TO &NVAR; %LET MISSTEST=%SCAN(&MVARS,&I,' '); IF &MISSTEST=. THEN DELETE; %END; %IF &TIME^= %THEN %DO; IF &TIME=. THEN DELETE; %END; DATA __CASE; SET __CASE END=EOF; KEEP __IDCA __CA1-__CA&NVAR __R &mvars %if &time^= %then %do; __catime %end; ; __IDCA=&IDCA; %if &time^= %then %do; __catime=&time; %end; %DO I=1 %TO &NVAR; __CA&I=&&V&I; %END; SEED=&SEEDCA; __R=RANUNI( SEED ); IF EOF THEN CALL SYMPUT('NCA',_N_); PROC SORT; BY __R __IDCA; DATA __CONT; SET &CONTROL; %DO I=1 %TO &NVAR; %LET MISSTEST=%SCAN(&MVARS,&I,' '); IF &MISSTEST=. THEN DELETE; %END; %IF &TIME^= %THEN %DO; IF &TIME=. THEN DELETE; %END; DATA __CONT; SET __CONT END=EOF; KEEP __IDCO __CO1-__CO&NVAR __R &mvars %if &time^= %then %do; __cotime %end; ; __IDCO=&IDCO; %if &time^= %then %do; __cotime=&time; %end; %DO I=1 %TO &NVAR; __CO&I=&&V&I; %END; SEED=&SEEDCO; __R=RANUNI( SEED ); IF EOF THEN CALL SYMPUT('NCO',_N_); RUN; %LET BAD2=0; %IF &NCO < %EVAL(&NCA*&NCONTLS) %THEN %DO; %PUT ERROR: NOT ENOUGH CONTROLS TO MAKE REQUESTED MATCHES; %LET BAD2=1; %END; %IF &BAD2=0 %THEN %DO; PROC SORT; BY __R __IDCO; DATA __MATCH; KEEP __IDCA __CA1-__CA&NVAR __DIJ __MATCH __CONT_N %if &time^= %then %do; __catime __cotime %end; ; ARRAY __USED(&NCO) $ 1 _TEMPORARY_; DO __I=1 TO &NCO; __USED(__I)='0'; END; DO __I=1 TO &NCONTLS; DO __J=1 TO &NCA; SET __CASE POINT=__J; __SMALL=.; __MATCH=.; DO __K=1 TO &NCO; IF __USED(__K)='0' THEN DO; SET __CONT POINT=__K; __D=%DIJ IF __d^=. & (__SMALL=. | __D<__SMALL) %MAX1 %if &time^= %then %do; & __cotime > __catime %end; THEN DO; __SMALL=__D; __MATCH=__K; __DIJ=__D; __CONT_N=__I; END; END; END; IF __MATCH^=. THEN DO; __USED(__MATCH)='1'; OUTPUT; END; END; END; STOP; DATA &OUT; SET __MATCH; SET __CONT POINT=__MATCH; KEEP __IDCA __IDCO __CONT_N __DIJ __CA1-__CA&NVAR __CO1-__CO&NVAR __DIF1-__DIF&NVAR __WT1-__WT&NVAR %if &time^= %then %do; __catime __cotime %end; ; LABEL __IDCA="&IDCA/CASE" __IDCO="&IDCO/CONTROL" %if &time^= %then %do; __catime="&time/CASE" __cotime="&time/CONTROL" %end; __CONT_N='CONTROL/NUMBER' __DIJ='DISTANCE/D_IJ' %LBLS; %DO I=1 %TO &NVAR; __DIF&I=abs(__CA&I-__CO&I); __WT&I=&&W&I; %END; %END; %MEND GREEDY; %MACRO OPTIMAL; %GLOBAL BAD2; DATA __CASE; SET &CASE; %DO I=1 %TO &NVAR; %LET MISSTEST=%SCAN(&MVARS,&I,' '); IF &MISSTEST=. THEN DELETE; %END; %IF &TIME^= %THEN %DO; IF &TIME=. THEN DELETE; %END; DATA __CASE; SET __CASE END=EOF; KEEP __IDCA __CA1-__CA&NVAR &mvars %if &time^= %then %do; __catime %end; ; __IDCA=&IDCA; %if &time^= %then %do; __catime=&time; %end; %DO I=1 %TO &NVAR; __CA&I=&&V&I; %END; IF EOF THEN CALL SYMPUT('NCA',_N_); DATA __CONT; SET &CONTROL; %DO I=1 %TO &NVAR; %LET MISSTEST=%SCAN(&MVARS,&I,' '); IF &MISSTEST=. THEN DELETE; %END; %IF &TIME^= %THEN %DO; IF &TIME=. THEN DELETE; %END; DATA __CONT; SET __CONT END=EOF; KEEP __IDCO __CO1-__CO&NVAR &mvars %if &time^= %then %do; __cotime %end; ; __IDCO=&IDCO; %if &time^= %then %do; __cotime=&time; %end; %DO I=1 %TO &NVAR; __CO&I=&&V&I; %END; IF EOF THEN CALL SYMPUT('NCO',_N_); RUN; %LET BAD2=0; %IF &NCO < %EVAL(&NCA*&NCONTLS) %THEN %DO; %PUT ERROR: NOT ENOUGH CONTROLS TO MAKE REQUESTED MATCHES; %LET BAD2=1; %END; %IF &BAD2=0 %THEN %DO; DATA __DIST1; SET __CASE; LENGTH __FROM __TO $ 80; DO I=1 TO &NCO; SET __CONT POINT=I; _COST_=%DIJ; __FROM=left(__IDCA); __TO=left(trim(__IDCO) || '_co'); _CAPAC_=1; IF _COST_^=. THEN DO; %MAX2 END; END; DATA __GOODCO; SET __DIST1; KEEP __IDCO; PROC SORT; BY __IDCO; DATA __GOODCO; SET __GOODCO; BY __IDCO; IF FIRST.__IDCO; data _null_; i=1; set __goodco point=i nobs=n; call symput('newcont',n); stop; DATA __DIST2; LENGTH __FROM __TO $ 80; DO I=1 TO N; SET __GOODCO POINT=I NOBS=N; __FROM=left(trim(__IDCO) || '_co'); __TO='SK'; _COST_=0; _CAPAC_=1; OUTPUT; END; STOP; DATA __GOODCA; SET __DIST1; KEEP __IDCA; PROC SORT; BY __IDCA; DATA __GOODCA; SET __GOODCA; BY __IDCA; IF FIRST.__IDCA; DATA __DIST3; LENGTH __FROM __TO $ 80; DO I=1 TO N; SET __GOODCA POINT=I NOBS=N; __FROM='SC'; __TO=left(__idca); _COST_=0; %if &mincont= %then %do; _CAPAC_=&NCONTLS; %end; %else %do; _capac_=&mincont; %end; OUTPUT; END; %if &mincont^= %then %do; __from='SC'; __to='EXTRA'; _capac_=&newcont-&mincont*n; _cost_=0; output; do i=1 to n; set __goodca point=i; __from='EXTRA'; __to=left(__idca); _cost_=0; _capac_=&maxcont-&mincont; output; end; %end; CALL SYMPUT('NEWCASE',N); STOP; DATA __DIST; SET __DIST1 __DIST2 __DIST3; %LET DEM=%EVAL(&NEWCASE*&NCONTLS); PROC NETFLOW MAXIT1=&MAXITER %if &mincont= %then %do; DEMAND=&DEM %end; %else %do; demand=&newcont %end; SOURCENODE='SC' SINKNODE='SK' ARCDATA=__DIST ARCOUT=__MATCH; TAIL __FROM; HEAD __TO; DATA __OUT; SET __MATCH; IF _FLOW_>0 & __FROM^in ('SC' 'EXTRA') & __TO^='SK'; __DIJ=_FCOST_; %DO I=1 %TO &NVAR; __DIF&I=abs(__CA&I-__CO&I); __WT&I=&&W&I; %END; PROC SORT; BY __IDCA __DIJ; DATA &OUT; SET __OUT; BY __IDCA; drop __from -- _status_; IF FIRST.__IDCA THEN __CONT_N=0; __CONT_N+1; LABEL __IDCA="&IDCA/CASE" __IDCO="&IDCO/CONTROL" %if &time^= %then %do; __catime="&time/CASE" __cotime="&time/CONTROL" %end; __CONT_N='CONTROL/NUMBER' __DIJ='DISTANCE/D_IJ' %LBLS; %END; %MEND OPTIMAL; %IF &BAD=0 %THEN %DO; %IF %UPCASE(&METHOD)=GREEDY %THEN %DO; %GREEDY %END; %ELSE %DO; %OPTIMAL %END; %IF &BAD2=0 %THEN %DO; PROC SORT DATA=&OUT; BY __IDCA __CONT_N; proc sort data=__case; by __IDCA; data &outnmca; merge __case &out(in=__inout where=(__cont_n=1)); by __idca; if __inout=0; **non-matches; proc sort data=__cont; by __IDCO; proc sort data=&out; by __IDCO; data &outnmco; merge __cont &out(in=__inout); by __idco; if __inout=0; **non-matched controls; proc sort data=&out; by __IDCA; **re-sort by case id; %if %upcase(&print)=Y %then %do; PROC PRINT data=&out LABEL SPLIT='/'; VAR __IDCA __IDCO __CONT_N %if &time^= %then %do; __catime __cotime %end; __DIJ %VBLES; sum __dij; title9'Data listing for matched cases and controls'; footnote "match macro: case=&case control=&control idca=&idca idco=&idco"; footnote2 " mvars=&mvars wts=&wts dmaxk=&dmaxk dmax=&dmax ncontls=&ncontls"; %if &time^= %then %do; footnote3"time=&time method=&method seedca=&seedca seedco=&seedco"; %end; %else %do; footnote3" method=&method seedca=&seedca seedco=&seedco"; %end; footnote4" out=&out outnmca=&outnmca outnmco=&outnmco"; run; title9'Summary data for matched cases and controls'; proc means data=&out n mean sum min max; class __cont_n; var __dij %if &nvar >=2 %then %do; __dif1-__dif&nvar __ca1-__ca&nvar %if &time^= %then %do; __catime %end; __co1-__co&nvar %if &time^= %then %do; __cotime %end; ; %end; %else %do; __dif1 __ca1 %if &time^= %then %do; __catime %end; __co1 %if &time^= %then %do; __cotime %end; ; %end; run; proc means data=&outnmca n mean sum min max; var &mvars; title9'Summary data for NON-matched cases'; run; proc means data=&outnmco n mean sum min max; var &mvars; title9'Summary data for NON-matched controls'; run; %end; %END; %END; title9; footnote; run; %MEND MATCH; *************************************************************************************************** /*Both OPTIMAL and GREEDY matching techniques DO NOT allow repeats - without replacement matching*/ ***************************************************************************************************; /*OPTIMAL matching*/ %MATCH(CASE=case,CONTROL=control,IDCA=country_year,IDCO=country_year, MVARS=propensity_hat,WTS=1,DMAXK=0.025, NCONTLS=1, /*NCONTLS is ignored for OPTIMAL*/ METHOD=OPTIMAL /*GREEDY*/,MAXITER=100000, PRINT=y, /*print matches y/n */ OUT=__OUT, /*data set with matched cases*/ OUTNMCA=__NMCA, /*data set with NON-matched cases*/ OUTNMCO=__NMCO, /*data set with NON-matched controls*/ MINCONT=1,MAXCONT=5); /*minimum and maximum number of matches for each case*/ *data list; /*to see repeats*/ *set __out; *keep __IDCO; *run; *proc sort data=list; /*to see repeats*/ *by __IDCO; *run; ***************************************************************************; ***************************************************************************; /*Working with matches*/ ***************************************************************************; ***************************************************************************; proc univariate data=__out; var __CA1; histogram __CA1 /normal cbarline=grey midpoints=0 to 1 by .01 ; title 'Propensity Score for Matched Participants'; run; proc sort data =__out; by __CA1; /*by propensity score for CASE*/ run; /*Label matches first*/ data __out; set __out; match_id=_n_; /*indicator identifying matches*/ run; data out_case; set __out; keep __IDCA match_id; run; data out_case; set out_case; country_year=__IDCA; run; proc sort data=out_case; by country_year; run; data out_control; set __out; keep __IDCO match_id; run; data out_control; set out_control; country_year=__IDCO; run; proc sort data=out_control; by country_year; run; proc sort data=imr; by country_year; run; data new_matched; /*this file has all the data and match_id*/ merge imr out_case out_control; by country_year; run; data case_data; set new_matched; where __IDCA ne ''; case_BCA_Y_T=BCA_Y_T; case_BCA_Y_Tm1=BCA_Y_Tm1; case_BCA_Y_Tm2=BCA_Y_Tm2; case_BCA_Y_Tm3=BCA_Y_Tm3; case_BCA_Y_Tm4=BCA_Y_Tm4; case_BCA_Y_Tm5=BCA_Y_Tm5; case_BCA_Y_Tp1=BCA_Y_Tp1; case_BCA_Y_Tp2=BCA_Y_Tp2; case_BCA_Y_Tp3=BCA_Y_Tp3; case_BCA_Y_Tp4=BCA_Y_Tp4; case_BCA_Y_Tp5=BCA_Y_Tp5; case_BCA_Y_Tm1_T=BCA_Y_Tm1_T; case_BCA_Y_Tm2_Tm1=BCA_Y_Tm2_Tm1; case_BCA_Y_Tm3_Tm2=BCA_Y_Tm3_Tm2; case_BCA_Y_Tm1_Tp1=BCA_Y_Tm1_Tp1; case_BCA_Y_Tm1_Tp2=BCA_Y_Tm1_Tp2; case_BCA_Y_Tm1_Tp3=BCA_Y_Tm1_Tp3; case_BCA_Y_Tm3_Tm1=BCA_Y_Tm3_Tm1; case_BCA_Y_Tm4_Tm1=BCA_Y_Tm4_Tm1; case_BCA_Y_Tm5_Tm1=BCA_Y_Tm5_Tm1; case_GROWTH_RPC_T=GROWTH_RPC_T; case_GROWTH_RPC_Tm1=GROWTH_RPC_Tm1; case_GROWTH_RPC_Tm2=GROWTH_RPC_Tm2; case_GROWTH_RPC_Tm3=GROWTH_RPC_Tm3; case_GROWTH_RPC_Tm4=GROWTH_RPC_Tm4; case_GROWTH_RPC_Tm5=GROWTH_RPC_Tm5; case_GROWTH_RPC_Tp1=GROWTH_RPC_Tp1; case_GROWTH_RPC_Tp2=GROWTH_RPC_Tp2; case_GROWTH_RPC_Tp3=GROWTH_RPC_Tp3; case_GROWTH_RPC_Tp4=GROWTH_RPC_Tp4; case_GROWTH_RPC_Tp5=GROWTH_RPC_Tp5; case_GROWTH_RPC_Tm1_T=GROWTH_RPC_Tm1_T; case_GROWTH_RPC_Tm2_Tm1=GROWTH_RPC_Tm2_Tm1; case_GROWTH_RPC_Tm3_Tm2=GROWTH_RPC_Tm3_Tm2; case_GROWTH_RPC_Tm1_Tp1=GROWTH_RPC_Tm1_Tp1; case_GROWTH_RPC_Tm1_Tp2=GROWTH_RPC_Tm1_Tp2; case_GROWTH_RPC_Tm1_Tp3=GROWTH_RPC_Tm1_Tp3; case_GROWTH_RPC_Tm3_Tm1=GROWTH_RPC_Tm3_Tm1; case_GROWTH_RPC_Tm4_Tm1=GROWTH_RPC_Tm4_Tm1; case_GROWTH_RPC_Tm5_Tm1=GROWTH_RPC_Tm5_Tm1; case_GCB_Y_T=GCB_Y_T; case_GCB_Y_Tm1=GCB_Y_Tm1; case_GCB_Y_Tm2=GCB_Y_Tm2; case_GCB_Y_Tm3=GCB_Y_Tm3; case_GCB_Y_Tm4=GCB_Y_Tm4; case_GCB_Y_Tm5=GCB_Y_Tm5; case_GCB_Y_Tp1=GCB_Y_Tp1; case_GCB_Y_Tp2=GCB_Y_Tp2; case_GCB_Y_Tp3=GCB_Y_Tp3; case_GCB_Y_Tp4=GCB_Y_Tp4; case_GCB_Y_Tp5=GCB_Y_Tp5; case_GCB_Y_Tm1_T=GCB_Y_Tm1_T; case_GCB_Y_Tm2_Tm1=GCB_Y_Tm2_Tm1; case_GCB_Y_Tm3_Tm2=GCB_Y_Tm3_Tm2; case_GCB_Y_Tm1_Tp1=GCB_Y_Tm1_Tp1; case_GCB_Y_Tm1_Tp2=GCB_Y_Tm1_Tp2; case_GCB_Y_Tm1_Tp3=GCB_Y_Tm1_Tp3; case_GCB_Y_Tm3_Tm1=GCB_Y_Tm3_Tm1; case_GCB_Y_Tm4_Tm1=GCB_Y_Tm4_Tm1; case_GCB_Y_Tm5_Tm1=GCB_Y_Tm5_Tm1; case_propensity_hat=propensity_hat; keep __IDCA match_id case_propensity_hat case_BCA_Y_T case_BCA_Y_Tm1 case_BCA_Y_Tm2 case_BCA_Y_Tm3 case_BCA_Y_Tm4 case_BCA_Y_Tm5 case_BCA_Y_Tp1 case_BCA_Y_Tp2 case_BCA_Y_Tp3 case_BCA_Y_Tp4 case_BCA_Y_Tp5 case_BCA_Y_Tm1_T case_BCA_Y_Tm2_Tm1 case_BCA_Y_Tm3_Tm2 case_BCA_Y_Tm1_Tp1 case_BCA_Y_Tm1_Tp2 case_BCA_Y_Tm1_Tp3 case_BCA_Y_Tm3_Tm1 case_BCA_Y_Tm4_Tm1 case_BCA_Y_Tm5_Tm1 case_GCB_Y_T case_GCB_Y_Tm1 case_GCB_Y_Tm2 case_GCB_Y_Tm3 case_GCB_Y_Tm4 case_GCB_Y_Tm5 case_GCB_Y_Tp1 case_GCB_Y_Tp2 case_GCB_Y_Tp3 case_GCB_Y_Tp4 case_GCB_Y_Tp5 case_GCB_Y_Tm1_T case_GCB_Y_Tm2_Tm1 case_GCB_Y_Tm3_Tm2 case_GCB_Y_Tm1_Tp1 case_GCB_Y_Tm1_Tp2 case_GCB_Y_Tm1_Tp3 case_GCB_Y_Tm3_Tm1 case_GCB_Y_Tm4_Tm1 case_GCB_Y_Tm5_Tm1 case_GROWTH_RPC_T case_GROWTH_RPC_Tm1 case_GROWTH_RPC_Tm2 case_GROWTH_RPC_Tm3 case_GROWTH_RPC_Tm4 case_GROWTH_RPC_Tm5 case_GROWTH_RPC_Tp1 case_GROWTH_RPC_Tp2 case_GROWTH_RPC_Tp3 case_GROWTH_RPC_Tp4 case_GROWTH_RPC_Tp5 case_GROWTH_RPC_Tm1_T case_GROWTH_RPC_Tm2_Tm1 case_GROWTH_RPC_Tm3_Tm2 case_GROWTH_RPC_Tm1_Tp1 case_GROWTH_RPC_Tm1_Tp2 case_GROWTH_RPC_Tm1_Tp3 case_GROWTH_RPC_Tm3_Tm1 case_GROWTH_RPC_Tm4_Tm1 case_GROWTH_RPC_Tm5_Tm1 ; run; proc sort data=case_data; by match_id; run; data control_data; set new_matched; where __IDCO ne ''; control_BCA_Y_T=BCA_Y_T; control_BCA_Y_Tm1=BCA_Y_Tm1; control_BCA_Y_Tm2=BCA_Y_Tm2; control_BCA_Y_Tm3=BCA_Y_Tm3; control_BCA_Y_Tm4=BCA_Y_Tm4; control_BCA_Y_Tm5=BCA_Y_Tm5; control_BCA_Y_Tp1=BCA_Y_Tp1; control_BCA_Y_Tp2=BCA_Y_Tp2; control_BCA_Y_Tp3=BCA_Y_Tp3; control_BCA_Y_Tp4=BCA_Y_Tp4; control_BCA_Y_Tp5=BCA_Y_Tp5; control_BCA_Y_Tm1_T=BCA_Y_Tm1_T; control_BCA_Y_Tm2_Tm1=BCA_Y_Tm2_Tm1; control_BCA_Y_Tm3_Tm2=BCA_Y_Tm3_Tm2; control_BCA_Y_Tm1_Tp1=BCA_Y_Tm1_Tp1; control_BCA_Y_Tm1_Tp2=BCA_Y_Tm1_Tp2; control_BCA_Y_Tm1_Tp3=BCA_Y_Tm1_Tp3; control_BCA_Y_Tm3_Tm1=BCA_Y_Tm3_Tm1; control_BCA_Y_Tm4_Tm1=BCA_Y_Tm4_Tm1; control_BCA_Y_Tm5_Tm1=BCA_Y_Tm5_Tm1; control_GROWTH_RPC_T=GROWTH_RPC_T; control_GROWTH_RPC_Tm1=GROWTH_RPC_Tm1; control_GROWTH_RPC_Tm2=GROWTH_RPC_Tm2; control_GROWTH_RPC_Tm3=GROWTH_RPC_Tm3; control_GROWTH_RPC_Tm4=GROWTH_RPC_Tm4; control_GROWTH_RPC_Tm5=GROWTH_RPC_Tm5; control_GROWTH_RPC_Tp1=GROWTH_RPC_Tp1; control_GROWTH_RPC_Tp2=GROWTH_RPC_Tp2; control_GROWTH_RPC_Tp3=GROWTH_RPC_Tp3; control_GROWTH_RPC_Tp4=GROWTH_RPC_Tp4; control_GROWTH_RPC_Tp5=GROWTH_RPC_Tp5; control_GROWTH_RPC_Tm1_T=GROWTH_RPC_Tm1_T; control_GROWTH_RPC_Tm2_Tm1=GROWTH_RPC_Tm2_Tm1; control_GROWTH_RPC_Tm3_Tm2=GROWTH_RPC_Tm3_Tm2; control_GROWTH_RPC_Tm1_Tp1=GROWTH_RPC_Tm1_Tp1; control_GROWTH_RPC_Tm1_Tp2=GROWTH_RPC_Tm1_Tp2; control_GROWTH_RPC_Tm1_Tp3=GROWTH_RPC_Tm1_Tp3; control_GROWTH_RPC_Tm3_Tm1=GROWTH_RPC_Tm3_Tm1; control_GROWTH_RPC_Tm4_Tm1=GROWTH_RPC_Tm4_Tm1; control_GROWTH_RPC_Tm5_Tm1=GROWTH_RPC_Tm5_Tm1; control_GCB_Y_T=GCB_Y_T; control_GCB_Y_Tm1=GCB_Y_Tm1; control_GCB_Y_Tm2=GCB_Y_Tm2; control_GCB_Y_Tm3=GCB_Y_Tm3; control_GCB_Y_Tm4=GCB_Y_Tm4; control_GCB_Y_Tm5=GCB_Y_Tm5; control_GCB_Y_Tp1=GCB_Y_Tp1; control_GCB_Y_Tp2=GCB_Y_Tp2; control_GCB_Y_Tp3=GCB_Y_Tp3; control_GCB_Y_Tp4=GCB_Y_Tp4; control_GCB_Y_Tp5=GCB_Y_Tp5; control_GCB_Y_Tm1_T=GCB_Y_Tm1_T; control_GCB_Y_Tm2_Tm1=GCB_Y_Tm2_Tm1; control_GCB_Y_Tm3_Tm2=GCB_Y_Tm3_Tm2; control_GCB_Y_Tm1_Tp1=GCB_Y_Tm1_Tp1; control_GCB_Y_Tm1_Tp2=GCB_Y_Tm1_Tp2; control_GCB_Y_Tm1_Tp3=GCB_Y_Tm1_Tp3; control_GCB_Y_Tm3_Tm1=GCB_Y_Tm3_Tm1; control_GCB_Y_Tm4_Tm1=GCB_Y_Tm4_Tm1; control_GCB_Y_Tm5_Tm1=GCB_Y_Tm5_Tm1; control_propensity_hat=propensity_hat; keep __IDCO match_id control_propensity_hat control_BCA_Y_T control_BCA_Y_Tm1 control_BCA_Y_Tm2 control_BCA_Y_Tm3 control_BCA_Y_Tm4 control_BCA_Y_Tm5 control_BCA_Y_Tp1 control_BCA_Y_Tp2 control_BCA_Y_Tp3 control_BCA_Y_Tp4 control_BCA_Y_Tp5 control_BCA_Y_Tm1_T control_BCA_Y_Tm2_Tm1 control_BCA_Y_Tm3_Tm2 control_BCA_Y_Tm1_Tp1 control_BCA_Y_Tm1_Tp2 control_BCA_Y_Tm1_Tp3 control_BCA_Y_Tm3_Tm1 control_BCA_Y_Tm4_Tm1 control_BCA_Y_Tm5_Tm1 control_GCB_Y_T control_GCB_Y_Tm1 control_GCB_Y_Tm2 control_GCB_Y_Tm3 control_GCB_Y_Tm4 control_GCB_Y_Tm5 control_GCB_Y_Tp1 control_GCB_Y_Tp2 control_GCB_Y_Tp3 control_GCB_Y_Tp4 control_GCB_Y_Tp5 control_GCB_Y_Tm1_T control_GCB_Y_Tm2_Tm1 control_GCB_Y_Tm3_Tm2 control_GCB_Y_Tm1_Tp1 control_GCB_Y_Tm1_Tp2 control_GCB_Y_Tm1_Tp3 control_GCB_Y_Tm3_Tm1 control_GCB_Y_Tm4_Tm1 control_GCB_Y_Tm5_Tm1 control_GROWTH_RPC_T control_GROWTH_RPC_Tm1 control_GROWTH_RPC_Tm2 control_GROWTH_RPC_Tm3 control_GROWTH_RPC_Tm4 control_GROWTH_RPC_Tm5 control_GROWTH_RPC_Tp1 control_GROWTH_RPC_Tp2 control_GROWTH_RPC_Tp3 control_GROWTH_RPC_Tp4 control_GROWTH_RPC_Tp5 control_GROWTH_RPC_Tm1_T control_GROWTH_RPC_Tm2_Tm1 control_GROWTH_RPC_Tm3_Tm2 control_GROWTH_RPC_Tm1_Tp1 control_GROWTH_RPC_Tm1_Tp2 control_GROWTH_RPC_Tm1_Tp3 control_GROWTH_RPC_Tm3_Tm1 control_GROWTH_RPC_Tm4_Tm1 control_GROWTH_RPC_Tm5_Tm1 ; run; proc sort data=control_data; by match_id; run; data combined; /*this file has all the data for the matched pairs*/ merge control_data case_data; by match_id; dif_BCA_Tm1_T=case_BCA_Y_Tm1_T - control_BCA_Y_Tm1_T; dif_GCB_Tm1_T=case_GCB_Y_Tm1_T - control_GCB_Y_Tm1_T; dif_GROWTH_RPC_Tm1_T=case_GROWTH_RPC_Tm1_T - control_GROWTH_RPC_Tm1_T; dif_BCA_Tm1_Tp1=case_BCA_Y_Tm1_Tp1 - control_BCA_Y_Tm1_Tp1; dif_GCB_Tm1_Tp1=case_GCB_Y_Tm1_Tp1 - control_GCB_Y_Tm1_Tp1; dif_GROWTH_RPC_Tm1_Tp1=case_GROWTH_RPC_Tm1_Tp1 - control_GROWTH_RPC_Tm1_Tp1; dif_BCA_Tm1_Tp2=case_BCA_Y_Tm1_Tp2 - control_BCA_Y_Tm1_Tp2; dif_GCB_Tm1_Tp2=case_GCB_Y_Tm1_Tp2 - control_GCB_Y_Tm1_Tp2; dif_GROWTH_RPC_Tm1_Tp2=case_GROWTH_RPC_Tm1_Tp2 - control_GROWTH_RPC_Tm1_Tp2; dif_BCA_Tm1_Tp3=case_BCA_Y_Tm1_Tp3 - control_BCA_Y_Tm1_Tp3; dif_GCB_Tm1_Tp3=case_GCB_Y_Tm1_Tp3 - control_GCB_Y_Tm1_Tp3; dif_GROWTH_RPC_Tm1_Tp3=case_GROWTH_RPC_Tm1_Tp3 - control_GROWTH_RPC_Tm1_Tp3; dif_BCA_Tm2_Tm1=case_BCA_Y_Tm2_Tm1 - control_BCA_Y_Tm2_Tm1; dif_GCB_Tm2_Tm1=case_GCB_Y_Tm2_Tm1 - control_GCB_Y_Tm2_Tm1; dif_GROWTH_RPC_Tm2_Tm1=case_GROWTH_RPC_Tm2_Tm1 - control_GROWTH_RPC_Tm2_Tm1; dif_BCA_Tm3_Tm2=case_BCA_Y_Tm3_Tm2 - control_BCA_Y_Tm3_Tm2; dif_GCB_Tm3_Tm2=case_GCB_Y_Tm3_Tm2 - control_GCB_Y_Tm3_Tm2; dif_GROWTH_RPC_Tm3_Tm2=case_GROWTH_RPC_Tm3_Tm2 - control_GROWTH_RPC_Tm3_Tm2; dif_BCA_Tm3_Tm1=case_BCA_Y_Tm3_Tm1 - control_BCA_Y_Tm3_Tm1; dif_GCB_Tm3_Tm1=case_GCB_Y_Tm3_Tm1 - control_GCB_Y_Tm3_Tm1; dif_GROWTH_RPC_Tm3_Tm1=case_GROWTH_RPC_Tm3_Tm1 - control_GROWTH_RPC_Tm3_Tm1; dif_BCA_Tm4_Tm1=case_BCA_Y_Tm4_Tm1 - control_BCA_Y_Tm4_Tm1; dif_GCB_Tm4_Tm1=case_GCB_Y_Tm4_Tm1 - control_GCB_Y_Tm4_Tm1; dif_GROWTH_RPC_Tm4_Tm1=case_GROWTH_RPC_Tm4_Tm1 - control_GROWTH_RPC_Tm4_Tm1; dif_BCA_Tm5_Tm1=case_BCA_Y_Tm5_Tm1 - control_BCA_Y_Tm5_Tm1; dif_GCB_Tm5_Tm1=case_GCB_Y_Tm5_Tm1 - control_GCB_Y_Tm5_Tm1; dif_GROWTH_RPC_Tm5_Tm1=case_GROWTH_RPC_Tm5_Tm1 - control_GROWTH_RPC_Tm5_Tm1; dif_BCA_Tm1=case_BCA_Y_Tm1 - control_BCA_Y_Tm1; dif_GCB_Tm1=case_GCB_Y_Tm1 - control_GCB_Y_Tm1; dif_GROWTH_RPC_Tm1=case_GROWTH_RPC_Tm1 - control_GROWTH_RPC_Tm1; run; data combined; set combined; where dif_BCA_Tm1_T ne . and dif_BCA_Tm1_Tp1 ne . and dif_BCA_Tm1_Tp2 ne . and dif_BCA_Tm1_Tp3 ne . and dif_BCA_Tm3_Tm1 ne . and dif_BCA_Tm4_Tm1 ne . and dif_BCA_Tm5_Tm1 ne . and dif_GCB_Tm1_T ne . and dif_GCB_Tm1_Tp1 ne . and dif_GCB_Tm1_Tp2 ne . and dif_GCB_Tm1_Tp3 ne . and dif_GCB_Tm3_Tm1 ne . and dif_GCB_Tm4_Tm1 ne . and dif_GCB_Tm5_Tm1 ne . and dif_GROWTH_RPC_Tm1_T ne . and dif_GROWTH_RPC_Tm1_Tp1 ne . and dif_GROWTH_RPC_Tm1_Tp2 ne . and dif_GROWTH_RPC_Tm1_Tp3 ne . and dif_GROWTH_RPC_Tm3_Tm1 ne . and dif_GROWTH_RPC_Tm4_Tm1 ne . and dif_GROWTH_RPC_Tm5_Tm1 ne . ; run; /*Treatement effect WITHOUT controlling for initial conditions*/ title 'Treatement effect WITHOUT controlling for initial conditions'; proc univariate data=combined; /*to evaluate impact of the programs on current account*/ var dif_BCA_Tm1_T ; title2 'Horizon T'; run; proc univariate data=combined; /*to evaluate impact of the programs on fiscal balance*/ var dif_GCB_Tm1_T; title2 'Horizon T'; run; proc univariate data=combined; /*to evaluate impact of the programs on economic growth*/ var dif_GROWTH_RPC_Tm1_T; title2 'Horizon T'; run; proc univariate data=combined; /*to evaluate impact of the programs on current account*/ var dif_BCA_Tm1_Tp1 ; title2 'Horizon T+1'; run; proc univariate data=combined; /*to evaluate impact of the programs on fiscal balance*/ var dif_GCB_Tm1_Tp1; title2 'Horizon T+1'; run; proc univariate data=combined; /*to evaluate impact of the programs on economic growth*/ var dif_GROWTH_RPC_Tm1_Tp1; title2 'Horizon T+1'; run; proc univariate data=combined; /*to evaluate impact of the programs on current account*/ var dif_BCA_Tm1_Tp2 ; title2 'Horizon T+2'; run; proc univariate data=combined; /*to evaluate impact of the programs on fiscal balance*/ var dif_GCB_Tm1_Tp2; title2 'Horizon T+2'; run; proc univariate data=combined; /*to evaluate impact of the programs on economic growth*/ var dif_GROWTH_RPC_Tm1_Tp2; title2 'Horizon T+2'; run; proc univariate data=combined; /*to evaluate impact of the programs on current account*/ var dif_BCA_Tm1_Tp3 ; title2 'Horizon T+3'; run; proc univariate data=combined; /*to evaluate impact of the programs on fiscal balance*/ var dif_GCB_Tm1_Tp3; title2 'Horizon T+3'; run; proc univariate data=combined; /*to evaluate impact of the programs on economic growth*/ var dif_GROWTH_RPC_Tm1_Tp3; title2 'Horizon T+3'; run; /*Creating differences by AVERAGING over Not-Participants first*/ data averages; set combined; run; proc sort data=averages; by __IDCA; run; proc means data=averages; by __IDCA; var control_BCA_Y_Tm1_T control_GCB_Y_Tm1_T control_GROWTH_RPC_Tm1_T control_BCA_Y_Tm1_Tp1 control_GCB_Y_Tm1_Tp1 control_GROWTH_RPC_Tm1_Tp1 control_BCA_Y_Tm1_Tp2 control_GCB_Y_Tm1_Tp2 control_GROWTH_RPC_Tm1_Tp2 control_BCA_Y_Tm1_Tp3 control_GCB_Y_Tm1_Tp3 control_GROWTH_RPC_Tm1_Tp3 case_BCA_Y_Tm1_T case_GCB_Y_Tm1_T case_GROWTH_RPC_Tm1_T case_BCA_Y_Tm1_Tp1 case_GCB_Y_Tm1_Tp1 case_GROWTH_RPC_Tm1_Tp1 case_BCA_Y_Tm1_Tp2 case_GCB_Y_Tm1_Tp2 case_GROWTH_RPC_Tm1_Tp2 case_BCA_Y_Tm1_Tp3 case_GCB_Y_Tm1_Tp3 case_GROWTH_RPC_Tm1_Tp3; OUTPUT OUT=new_averages MEAN=mean_control_BCA_Y_Tm1_T mean_control_GCB_Y_Tm1_T mean_control_GROWTH_RPC_Tm1_T mean_control_BCA_Y_Tm1_Tp1 mean_control_GCB_Y_Tm1_Tp1 mean_control_GROWTH_RPC_Tm1_Tp1 mean_control_BCA_Y_Tm1_Tp2 mean_control_GCB_Y_Tm1_Tp2 mean_control_GROWTH_RPC_Tm1_Tp2 mean_control_BCA_Y_Tm1_Tp3 mean_control_GCB_Y_Tm1_Tp3 mean_control_GROWTH_RPC_Tm1_Tp3 case_BCA_Y_Tm1_T case_GCB_Y_Tm1_T case_GROWTH_RPC_Tm1_T case_BCA_Y_Tm1_Tp1 case_GCB_Y_Tm1_Tp1 case_GROWTH_RPC_Tm1_Tp1 case_BCA_Y_Tm1_Tp2 case_GCB_Y_Tm1_Tp2 case_GROWTH_RPC_Tm1_Tp2 case_BCA_Y_Tm1_Tp3 case_GCB_Y_Tm1_Tp3 case_GROWTH_RPC_Tm1_Tp3; run; data new_averages; /*this file has all the data for the matched pairs with averages*/ set new_averages; mean_dif_BCA_Tm1_T=case_BCA_Y_Tm1_T - mean_control_BCA_Y_Tm1_T; mean_dif_GCB_Tm1_T=case_GCB_Y_Tm1_T - mean_control_GCB_Y_Tm1_T; mean_dif_GROWTH_RPC_Tm1_T=case_GROWTH_RPC_Tm1_T - mean_control_GROWTH_RPC_Tm1_T; mean_dif_BCA_Tm1_Tp1=case_BCA_Y_Tm1_Tp1 - mean_control_BCA_Y_Tm1_Tp1; mean_dif_GCB_Tm1_Tp1=case_GCB_Y_Tm1_Tp1 - mean_control_GCB_Y_Tm1_Tp1; mean_dif_GROWTH_RPC_Tm1_Tp1=case_GROWTH_RPC_Tm1_Tp1 - mean_control_GROWTH_RPC_Tm1_Tp1; mean_dif_BCA_Tm1_Tp2=case_BCA_Y_Tm1_Tp2 - mean_control_BCA_Y_Tm1_Tp2; mean_dif_GCB_Tm1_Tp2=case_GCB_Y_Tm1_Tp2 - mean_control_GCB_Y_Tm1_Tp2; mean_dif_GROWTH_RPC_Tm1_Tp2=case_GROWTH_RPC_Tm1_Tp2 - mean_control_GROWTH_RPC_Tm1_Tp2; mean_dif_BCA_Tm1_Tp3=case_BCA_Y_Tm1_Tp3 - mean_control_BCA_Y_Tm1_Tp3; mean_dif_GCB_Tm1_Tp3=case_GCB_Y_Tm1_Tp3 - mean_control_GCB_Y_Tm1_Tp3; mean_dif_GROWTH_RPC_Tm1_Tp3=case_GROWTH_RPC_Tm1_Tp3 - mean_control_GROWTH_RPC_Tm1_Tp3; run; /*Treatement effect WITHOUT controlling for initial conditions asuming AVERAGING first*/ proc means data=new_averages; /*to evaluate impact of the programs on current account*/ var mean_dif_BCA_Tm1_T mean_dif_GCB_Tm1_T mean_dif_GROWTH_RPC_Tm1_T mean_dif_BCA_Tm1_Tp1 mean_dif_GCB_Tm1_Tp1 mean_dif_GROWTH_RPC_Tm1_Tp1 mean_dif_BCA_Tm1_Tp2 mean_dif_GCB_Tm1_Tp2 mean_dif_GROWTH_RPC_Tm1_Tp2 mean_dif_BCA_Tm1_Tp3 mean_dif_GCB_Tm1_Tp3 mean_dif_GROWTH_RPC_Tm1_Tp3; title 'Treatement effect WITHOUT controlling for initial conditions (AVERAGINING)'; run; /*Treatement effect WITH controlling for initial conditions (Restricting the coefficients to be the same)*/ title 'Treatement effect WITH controlling for initial conditions'; proc reg data=work.combined; model dif_BCA_Tm1_T = dif_GROWTH_RPC_Tm2_Tm1 dif_GCB_Tm2_Tm1 dif_BCA_Tm2_Tm1 dif_GROWTH_RPC_Tm3_Tm2 dif_GCB_Tm3_Tm2 dif_BCA_Tm3_Tm2 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T'; run; quit; proc reg data=work.combined; model dif_GCB_Tm1_T = /*dif_BCA_Tm1_T*/ dif_GROWTH_RPC_Tm2_Tm1 dif_GCB_Tm2_Tm1 dif_BCA_Tm2_Tm1 dif_GROWTH_RPC_Tm3_Tm2 dif_GCB_Tm3_Tm2 dif_BCA_Tm3_Tm2 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1/dw; title 'Horizon T'; run; quit; title 'Treatement effect WITH controlling for initial conditions'; proc reg data=work.combined; model dif_GROWTH_RPC_Tm1_T = dif_GROWTH_RPC_Tm2_Tm1 dif_GCB_Tm2_Tm1 dif_BCA_Tm2_Tm1 dif_GROWTH_RPC_Tm3_Tm2 dif_GCB_Tm3_Tm2 dif_BCA_Tm3_Tm2 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T'; run; quit; proc reg data=work.combined; model dif_BCA_Tm1_Tp1 = dif_GROWTH_RPC_Tm3_Tm1 dif_GCB_Tm3_Tm1 dif_BCA_Tm3_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T+1'; run; quit; proc reg data=work.combined; model dif_GCB_Tm1_Tp1 = /*dif_BCA_Tm1_Tp1*/ dif_GROWTH_RPC_Tm3_Tm1 dif_GCB_Tm3_Tm1 dif_BCA_Tm3_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title 'Horizon T+1'; run; quit; proc reg data=work.combined; model dif_GROWTH_RPC_Tm1_Tp1 = dif_GROWTH_RPC_Tm3_Tm1 dif_GCB_Tm3_Tm1 dif_BCA_Tm3_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T+1'; run; quit; proc reg data=work.combined; model dif_BCA_Tm1_Tp2 = dif_GROWTH_RPC_Tm4_Tm1 dif_GCB_Tm4_Tm1 dif_BCA_Tm4_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T+2'; run; quit; proc reg data=work.combined; model dif_GCB_Tm1_Tp2 = /*dif_BCA_Tm1_Tp2*/ dif_GROWTH_RPC_Tm4_Tm1 dif_GCB_Tm4_Tm1 dif_BCA_Tm4_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title 'Horizon T+2'; run; quit; proc reg data=work.combined; model dif_GROWTH_RPC_Tm1_Tp2 = dif_GROWTH_RPC_Tm4_Tm1 dif_GCB_Tm4_Tm1 dif_BCA_Tm4_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T+2'; run; quit; proc reg data=work.combined; model dif_BCA_Tm1_Tp3 = dif_GROWTH_RPC_Tm5_Tm1 dif_GCB_Tm5_Tm1 dif_BCA_Tm5_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T+3'; run; quit; proc reg data=work.combined; model dif_GCB_Tm1_Tp3 = /*dif_BCA_Tm1_Tp3*/ dif_GROWTH_RPC_Tm5_Tm1 dif_GCB_Tm5_Tm1 dif_BCA_Tm5_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title 'Horizon T+3'; run; quit; proc reg data=work.combined; model dif_GROWTH_RPC_Tm1_Tp3 = dif_GROWTH_RPC_Tm5_Tm1 dif_GCB_Tm5_Tm1 dif_BCA_Tm5_Tm1 dif_GROWTH_RPC_Tm1 dif_GCB_Tm1 dif_BCA_Tm1 /dw; title2 'Horizon T+3'; run; quit; ods html close;