/*This macro calculates the mean signal intensity of the */ /*replicates per probe per treatment. The results are output in*/ /*a data set with column for the probes and a column for */ /*the means of each treatment. Additionally, the median, first */ /*quartile (q1), third quartile (q3), minimum and maximum values*/ /*can be calculated by uncommenting lines as necessary. */ %macro mean_trt(infile,trt,signal,probe_id,trtn,prefix,suffix); *sorting data set makes proc means run faster; proc sort data= &infile; by &probe_id &trt; run; *the mean (median, q1, q3, min and max if the comments are removed) is (are) calculated and output; proc means data= &infile noprint; class &probe_id &trt; var &signal; output out=&prefix.outmeans&suffix mean=mean /*remove comments if median is wanted*/ /*median=median*/ /*remove comments if q1 is wanted*/ /*q1=q1*/ /*remove comments if q3 is wanted*/ /*q3=q3*/ /*remove comments if min is wanted*/ /*min=min*/ /*remove comments if max is wanted*/ /*max=max*/; run; *the treatment, prefix and suffix are added to uniquely the calculation(s); data means_&trtn; set &prefix.outmeans&suffix; where &trt="&trtn"; &prefix.mean_&trtn&suffix=mean; /*remove comments if median is wanted*/ /*&prefix.median_&trtn&suffix=median;*/ /*remove comments if q1 is wanted*/ /*&prefix.q1_&trtn&suffix=q1;*/ /*remove comments if q3 is wanted*/ /*&prefix.q3_&trtn&suffix=q3;*/ /*remove comments if min is wanted*/ /*&prefix.min_&trtn&suffix=min;*/ /*remove comments if max is wanted*/ /*&prefix.max_&trtn&suffix=max;*/ keep &probe_id &prefix.mean_&trtn&suffix /*remove comments if median is wanted*/ /*&prefix.median_&trtn&suffix*/ /*remove comments if q1 is wanted*/ /*&prefix.q1_&trtn&suffix*/ /*remove comments if q3 is wanted*/ /*&prefix.q3_&trtn&suffix*/ /*remove comments if min is wanted*/ /*&prefix.min_&trtn&suffix*/ /*remove comments if max is wanted*/ /*&prefix.max_&trtn&suffix*/; run; %mend mean_trt; %macro all_trt(infile,trt,signal,probe_id,trt1,trt2,trt3,trt4, trt5,trt6,trt7,trt8,trt9,trt10,trt11,trt12,trt13,trt14,trt15,trt16,prefix,suffix); *the statistics for each of the treatments are calculated; %do i=1 %to 16; %mean_trt(&infile,&trt,&signal,&probe_id,&&trt&i,&prefix,&suffix); %end; *the statistics for each of the treatments is merged into a single data set that contains a column for every statistic for all treatments; merge means_&trt1 means_&trt2 means_&trt3 means_&trt4 means_&trt5 means_&trt6 means_&trt7 means_&trt8 means_&trt9 means_&trt10 means_&trt11 means_&trt12 means_&trt13 means_&trt14 means_&trt15 means_&trt16; by &probe_id; drop mean_ /*remove comments if median is wanted*/ /*median_*/ /*remove comments if q1 is wanted*/ /*q1_*/ /*remove comments if q3 is wanted*/ /*q3_*/ /*remove comments if min is wanted*/ /*min_*/ /*remove comments if max is wanted*/ /*max_*/; run; %mend all_trt;