/*********************************************************************** ***********/ /** author : G.Eckert **/ /** title : Z-Score Macro for comparing means from 2 log-normal samples **/ /** program : zscore.mac **/ /** date : 03/06/97 **/ /** **/ /** Implementation of method used on Biometrics 53, September 1997 'Methods **/ /** for Comparing the Means of Two Independent Log-Normal Samples' by **/ /** XH Zhou, S Gao, and SL Hui, pp 1129-1135. **/ /*********************************************************************** ***********/ %macro zscore(data, class, response, offset); /* offset variable used to add value to data so log transformation can be done */ %if &OFFSET = %then &OFFSET = 0; data dsn; set &DATA; logdata = log(&RESPONSE + &OFFSET); proc sort data=dsn out=dsn; by &CLASS; proc means n mean var noprint data=dsn; var logdata; output out=zscore (drop=_TYPE_ _FREQ_) n=n mean=mean var=var; by &CLASS; run; data _NULL_; set zscore; if &CLASS = 0 then do; call symput('n0', n); call symput('mu0', mean); call symput('var0', var); end; else if &CLASS = 1 then do; call symput('n1', n); call symput('mu1', mean); call symput('var1', var); end; run; data zscore; set zscore; if &CLASS = 0 then do; zscore = (&MU1 - &MU0 + 0.5 * (&VAR1 - &VAR0)) / sqrt( &VAR0/&N0 + &VAR1/&N1 + 0.5 * ( &VAR0*&VAR0/(&N0-1) + &VAR1*&VAR1/(&N1-1) ) ); pvalue = 2 * probnorm( -1 * abs(zscore)); variable = "&RESPONSE"; end; proc print data=zscore; run; %mend zscore;