Hi: HOLD_SNUM should NOT be on the COLUMN statement. Temporary variables are variables that you use within a COMPUTE block, but they are NOT on a COLUMN statement. As soon as you put HOLD_SNUM on a COLUMN statement, it stops being a temporary variable whose value is retained.
AND, you have HOLD_SNUM on the COLUMN statement before CATCOUNT, the variable whose value you want to "grab" -- that violates the Left to Right rule of PROC REPORT. At the point in time when HOLD_SNUM in YOUR code example is being added to the report row, PROC REPORT had no visibility of the value for CATCOUNT.
Also, you are mixing ODS style override options and LISTING options like DOL, DUL, SKIP and LS and BOX that will be IGNORED by ODS destinations.
Without data, nobody can run your code. However, in the code below, I've used SASHELP.SHOES, so anyone can run it.
Note that I do NOT have hold_reg or hold_prd temporary variables on the COLUMN statement. They are used exclusively in the COMPUTE block to hold and then use the values for region and product.
Here's the code:
proc sort data=sashelp.shoes out=newshoes;
where region in ('Western Europe' 'Eastern Europe') and product in ('Sandal' 'Slipper');
by region product;
run;
** run 1 time, observe how hold_reg and hold_prd temporary variables;
** are used. Then remove comments from noprint option and rerun again;
proc report data=newshoes;
column region product showall showprod sales;
define region / group "Default Region" /* noprint */;
define product / order "Default Product" /* noprint */;
define showall / computed "Computed Region" ;
define showprod / computed "Computed Product";
define sales / sum;
compute before region;
length hold_reg $25;
hold_reg = region;
endcomp;
compute before product;
length hold_prd $25;
hold_prd = product;
endcomp;
compute showall / character length=25;
showall = hold_reg;
endcomp;
compute showprod / character length=25;
showprod = hold_prd;
endcomp;
break after region / summarize style=Header{background=lightyellow};
break after product / summarize style=Header{color=black};
rbreak after / summarize style=Header{background=lightgreen};
compute after region;
showall = catx(' ','Total',hold_reg);
showprod = 'All Products';
** how to simulate a SKIP in ODS output;
line ' ';
endcomp;
compute after product;
showprod = 'SubTotal';
endcomp;
compute after;
showall = 'Grand Total';
showprod = 'All Regions';
endcomp;
run;
Here's the output:
Hope this helps,
Cynthia
... View more