Hi:
I'm not sure why you are using ABSOLUTE COLUMN NUMBERs here... they are not appropriate since you don't have any ACROSS items. Your real problem is that your COLUMN statement shows INVOICE as appearing BEFORE MAX_OF_INVOICE in the COLUMN statement. That means:
In a COMPUTE block for INVOICE, PROC REPORT only knows the value of MAKE. It does NOT yet know the value of SEQ or MAX_OF_INVOICE -- because PROC REPORT works from left-to-right in placing items on the report row. So a variable in a COLUMN statement can only test a value that appears BEFORE it on the COLUMN statement -- as shown above. SEQ and MAX_OF_INVOICE are not known to PROC REPORT in the COMPUTE block for INVOICE.
I also don't know why you have or need so many PROC SQL steps. I'm also not sure of the purpose of the SEQ variable. You probably don't want MAKE to be a usage of GROUP, I would guess you mean for it to be a usage of ORDER and maybe you are forcing SEQ to show every row because with a usage of GROUP for MAKE, all the numeric rows would collapse down to 1 row for each make and be summarized.
However, you're sorting the SASHELP.CARS by MAKE and INVOICE -- which means that last value for MAKE will always be the MAX value. There are really 2 possible solutions without all the SQL steps (but keeping the DATA step so you get SEQ -- and one of my solutions uses a macro variable for each MAKE value to hold the max amount for that MAKE.)
Here's how I made the data:
Then here's report 1 using the CARS2 data:
And here is alternate approach 2 using the CARS2 data and the macro variables from the DATA step program:
If you want to hide the column for MAKE that shows the ORDER usage, then just remove the comment delimiters from around the NOPRINT option.
Hope this gives you some other ideas for a solution.
Cynthia