/* This macro finds bootstrap and bias-corrected bootstrap confidence limits from a number of bootstrap estimates of the three path mediated effect output from another program such as LISREL. It was written to accompany Taylor, A. B., MacKinnon, D. P., and Tein, J. -Y. (in press). Tests of the three-path mediated effect. Organizational Research Methods. How to use the macro: 1. Open your data set that has bootstrap estimates of the mediated effect. 2. Change the input parameters for the macro at the bottom of this file to indicate the name of your data set, variable name, and desired confidence interval percentage. The input parameters are described in more detail at the bottom. 3. Run the macro, including both the code that makes up the macro (from %macro to %mend) and the macro call (%bootcl). */ %macro bootcl(sampest,dataset,varname,clpct); * Convert confidence limit percent into percentiles for confidence interval. ; data _NULL_; * Save percentiles as percentages (e.g., 2.5 and 97.5) ; lowerpct=(100-&clpct)/2; upperpct=100-lowerpct; call symput('lowerpct',lowerpct); call symput('upperpct',upperpct); run; * Get percentile bootstrap confidence limits. ; proc univariate data=&dataset noprint; var &varname; output out=pboot std=bootse pctlpts=&lowerpct &upperpct pctlpre=pb pctlname=lcl ucl; run; * Get p and z0 for bias-corrected bootstrap. ; data findp; set &dataset; if &varname > &sampest then p=1; else p=0; run; proc means data=findp noprint; output out=findp2 mean(p)=p; run; data _NULL_; set findp2; z0=probit(1-p); call symput('z0',z0); run; * Find percentiles to get for bias-corrected bootstrap. ; data _NULL_; zp=probit(&upperpct/100); roundpoint=100/&nboot; bcbzlo=(2*&z0)-zp; bcbzup=(2*&z0)+zp; bcbplo=probnorm(bcbzlo); bcbpup=probnorm(bcbzup); bcbpctlo=round(bcbplo*100,roundpoint); bcbpctup=round(bcbpup*100,roundpoint); call symput('bcbpctlo',bcbpctlo); call symput('bcbpctup',bcbpctup); run; * Get values for bias-corrected bootstrap confidence limits. ; proc univariate data=bootdist noprint; var bootmed; output out=bcboot pctlpts=&bcbpctlo &bcbpctup pctlpre=bcb pctlname=lcl ucl; run; * Combine and print results. ; data pboot1; set pboot; method='percentile bootstrap '; lcl=pblcl; ucl=pbucl; keep method lcl ucl; run; data bcboot1; set bcboot; method='bias-corrected bootstrap'; lcl=bcblcl; ucl=bcbucl; keep method lcl ucl; run; data result; set pboot1 bcboot1; label lcl="lower &clpct% limit" ucl="upper &clpct% limit"; run; options label; run; proc print data=result label; run; %mend bootcl; /* These are the macro input parameters: Sample estimate of the mediated effect (b1b2b3) ; Name of data set containing bootstrap estimates of the mediated effect ; Name of variable that has bootstrap estimates of the mediated effect ; Confidence interval percentage (e.g., 95) Replace the values in the line below with the appropriate names from your data. You can also change the confidence interval percentage. */ %bootcl(sampest,dataset,varname,95);