/*Prodclin.sas - MacKinnon, Fritz, Williams, and Lockwood, 2005 */ /*Dept. of Psychology, Arizona State University */ /*Necessary files:prodclin.sas, prodclin.exe */ /*The prodclin program calculates asymmetric confidence intervals for */ /*the mediated effect using the distribution of the product of two */ /*random variables and the Fortran program Prodclin.exe. To run, open*/ /* in SAS or copy and paste the code into a SAS editor window. Then, */ /*the location of the Fortran program needs to be entered in four */ /*places(both files should be in the same location). Next, values for*/ /*the a and b paths, as well as the standarderrors of a (sea) and b */ /*(seb) must be input in the macro call line at the end of the */ /*program. Lastly, values for rho (correlation between a and b, in */ /*most cases equal to zero) and alpha (the type 1 error rate) must be */ /*specified in the beginning of the program. Output consists of the */ /*user specified values for a, sea, b, seb, rho, alpha, ab, the first */ /*order standard error (sobelse), the lower and upper standardized */ /*critical values from Prodclin [low,high], the asymmetric confidence */ /*limits [prodlow,produp] and the corresponding normal theory */ /*confidence limits [normlow,normup]. If either prodlow or produp is */ /*equal to 99999, there was a problem with convergence in the Fortran */ /*program. First, check the values you input and then, if the problem*/ /*still occurs, try using fewer decimal places. */ /*All places that need user input have been labeled with comments. */ options noxwait; *Input values for rho and alpha; %let rho=0; %let alpha=.05; %macro prodclin(a, sea, b, seb); data data1; *Change file address to match the location of the file prodclin.exe; file "G:/raw.txt"; a=&a; sea=&sea; b=&b; seb=&seb; rho=ρ alpha=α put a @; put sea @; put b @; put seb @; put rho @; put alpha @;data data1; *Change file address to match the location of the file prodclin.exe; X cd G:/; *Change file address to match the location of the file prodclin.exe; X call "G:/prodclin.exe"; data data2; *Change file address to match the location of the file prodclin.exe; infile "G:/critval.txt"; input lcrit ucrit; a=&a; sea=&sea; b=&b; seb=&seb; rho=ρ alpha=α da=a/sea; db=b/seb; sedadb=sqrt(da*da+db*db+1); dadb=da*db; low=(lcrit-dadb)/(sedadb); high=(ucrit-dadb)/(sedadb); ab=a*b; sobelse=sqrt(a*a*seb*seb+b*b*sea*sea); prodlow=ab+low*sobelSE; produp=ab+high*sobelSE; nl=probit(alpha/2); normlow=ab+nl*sobelse; normup=ab-nl*sobelse; if lcrit=99999 then prodlow=99999; if ucrit=99999 then produp=99999; proc print data=data2 noobs; var a sea b seb ab sobelse rho alpha normlow normup low high prodlow produp; run; %mend; *Input values for a, st. error a, b, st. error b; *%prodclin(a=.3937, sea=.1872, b=-.8798, seb=.1910);*PHLAME example; %prodclin(a=.1701, sea=.0156, b=.1998, seb=.0364);*Duncan et al example; run; quit;