01-24-2013 05:10 PM
I have the following code that produces the Report I need. What I am having difficulty with is the summarize row. I would like to rename it to SchoolCode Total but it will not allow me. Is there anyway to do this?
PROC REPORT NOWD DATA=Q1 OUT=Q1A
NOFS HEADLINE HEADSKIP;
COLUMNS SCHOOLcODE RACE FCODE TOTAL;
DEFINE SCHOOLCODE / GROUP;
DEFINE RACE / DISPLAY;
DEFINE FCODE / DISPLAY;
DEFINE TOTAL/ ANALYSIS SUM;
BREAK AFTER SCHOOLCODE / SUMMARIZE ;
01-25-2013 08:14 AM
Just curious, why are you creating an OUTPUT dataset? Do you need this output in another step?
At any rate, you will need a COMPUTE block to do what you want. I believe there have been other postings. I am not in a position to make up dummy data right now. But one possibility is (untested code snippet):
compute after schoolcode;
schoolcode = 'Total';
Assuming that SCHOOLCODE is "big enough" (at least 5 characters in length), you should get what you want. Other desires, such as getting Total for XXX, requre a bit more work, but are also do-able.
01-30-2013 05:54 PM
You show RACE in your original code sample as a DISPLAY variable. As long as RACE is DISPLAY usage, you cannot do a COMPUTE AFTER. The only variables that can have COMPUTE AFTER (or BEFORE) are ORDER or GROUP variables. So, you could define RACE as either ORDER or GROUP and then you would be able to do a COMPUTE AFTER, pretty much, the code would look the same as what is shown above, except where you have SCHOOLCODE, you would now put RACE.
Also, depending on what you were going to COMPUTE and the length (number of characters) for the RACE variable, you may or may not be able to assign the string TOTAL to the RACE column (for example, if RACE was a code of 1,2 or 3), then you could not assign TOTAL at the break. But you could make a computed column to hold a longer name.
This documentation topic of how PROC REPORT builds a report is quite helpful:
In addition, I know that there are previous forum postings on break processing using PROC REPORT, with code examples. Here is a previous posting from this year: https://communities.sas.com/message/150671#150671 I am sure there are others.