/***************************************************** MACRO: SIGN SIGN TEST FOR LOCATION. INPUT: Either using summary statistics (called if summary=y): nobs: number of observations bstar: number of observations greater than the median under H0 -or- Using the raw data (called if summary=n) dname: input data set vfir: name of variable containing data theta0: value of median under H0 OUTPUT: One-sided p-values, pvup and pvdown Two-sided p-value pvpm *****************************************************/ options symbolgen mlogic mprint; %macro sign(summary,nobs,bstar,dname,vfir,theta0); %if %upcase(&summary)=Y %then %goto next; data zin; set &dname; b=(&vfir-&theta0 > 0); run; proc summary data=zin; var b; output out=zout sum=b n=nobs; run; data _null_; set zout; call symput('nobs',left(put(nobs,best10.))); run; data signout; set zout; pvdown=probbnml(0.5,&nobs,b); pvup=1-probbnml(0.5,&nobs,b-1); pvpm=2*min(pvdown,pvup); run; %goto print; %next: data signout; pvdown=probbnml(0.5,&nobs,&bstar); pvup=1-probbnml(0.5,&nobs,&bstar-1); pvpm=2*min(pvdown,pvup); %print: proc print data=signout noobs; %mend sign; /***************************************************** These two calls illustrate the two ways of calling the macro for the same set of data. *****************************************************/ %sign(n, , ,ma2612.grind,diameter,.75); %sign(y,150,93);