Please explain the use case for this, seems to be a strange report.
You can do this quite well using Proc REPORT and a compute block. You will need to have all the month columns twice, once for the SUM and once for the MEAN.
You can then check in which line of the report you are and fill the cells accordingly.
The code below uses the duplicate month columns with different statistics and a compute block to assign the proper value depending in which line you are the _BREAK_ variable tells you when you are on a break line. The _dummy variable shows the values.
data have;
length name measure $ 8;
array months{*} jan feb;
do name = "a", "b";
do measure = "x", "y", "z";
do j = 1 to 5;
do i = 1 to dim(months);
months{i} = ceil(ranuni(123) * 100);
end;
output;
end;
end;
end;
run;
/*%let doNotPrint = noprint;*/
%let doNotPrint = ;
proc report data=have;
column name measure jan=jan_sum jan=jan_mean feb=feb_sum feb=feb_mean _dummy;
define name / group;
define measure / group;
define jan_sum / analysis sum "jan" format=comma12.2;
define jan_mean / analysis mean "jan mean" &doNotPrint;
define feb_sum / analysis sum "feb" format=comma12.2;
define feb_mean / analysis mean "feb mean" &doNotPrint;
define _dummy / computed &doNotPrint;
break before name / summarize ;
compute _dummy / char length=32;
_dummy = catx(":", name, _break_);
if name = "a" and _break_ = "name" then do;
jan_sum = jan_mean;
feb_sum = feb_mean;
end;
endcomp;
run;
... View more