Hi-
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 ;
RUN;
Hi:
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';
endcomp;
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.
cynthia
Thank you Cynthia-
Cynthia-
How would I enter another compute after race in addition to schoolcode?
compute after schoolcode;
schoolcode = 'Total';
endcomp;
Hi:
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:
Base SAS(R) 9.3 Procedures Guide, Second Edition
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.
cynthia
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.