Hi,
I ran two proc reports
first one with a break after and rbreak after
PROC REPORT DATA=SASHELP.CLASS;
COLUMN SEX NAME AGE HEIGHT;
DEFINE SEX / GROUP;
DEFINE NAME / GROUP;
DEFINE AGE / SUM;
DEFINE HEIGHT / SUM;
BREAK AFTER SEX / SUMMARIZE;
RBREAK AFTER / SUMMARIZE;
COMPUTE AFTER SEX;
CALL DEFINE (_ROW_,"STYLE","STYLE=[BACKGROUND = GREEN]");
SEX = 'S';
ENDCOMP;
COMPUTE AFTER;
CALL DEFINE (_ROW_,"STYLE","STYLE=[BACKGROUND = RED]");
SEX = 'T';
ENDCOMP;
RUN;
And the second one with a break before and rbreak before.
PROC REPORT DATA=SASHELP.CLASS;
COLUMN SEX NAME AGE HEIGHT;
DEFINE SEX / GROUP;
DEFINE NAME / GROUP;
DEFINE AGE / SUM;
DEFINE HEIGHT / SUM;
BREAK BEFORE SEX / SUMMARIZE;
RBREAK BEFORE / SUMMARIZE;
COMPUTE BEFORE SEX;
CALL DEFINE (_ROW_,"STYLE","STYLE=[BACKGROUND = GREEN]");
SEX = 'S';
ENDCOMP;
COMPUTE BEFORE;
CALL DEFINE (_ROW_,"STYLE","STYLE=[BACKGROUND = RED]");
SEX = 'T';
ENDCOMP;
RUN;
Can someone please guide as to why the background and formatting change in the second report..
If you could direct to some sas notes that would help too..
Thanks
Hi:
I guess I don't understand your question. The BEFORE or AFTER in the BREAK and RBREAK statements determine where the subtotals and/or totals are going to placed in the output report. With the BEFORE location, all the summary lines come BEFORE (or above) the group to which they refer or at the top of the report. On the other hand, the AFTER location causes all the summary lines to appear AFTER (or at the bottom) of the group to which they refer or at the bottom of the report.
This is exactly the same behavior that I observe in your output. Did you have some other expectation? I am attaching a screen shot of the output produced by your code (but with fewer obs -- so the 2 reports could appear side by side). I put arrows on the screenshot to show exactly which COMPUTE block was responsible for the corresponding summary lines on the report.
cynthia
Message edited & corrected typo
Maybe it is the reason that output order of proc report is different. You should open a track with Technical Support.
But I would not code like yours, I will code like:
ods html file='c:\x2.html' style=sasweb; PROC REPORT DATA=SASHELP.CLASS nowd ; COLUMN SEX NAME AGE HEIGHT; DEFINE SEX / GROUP; DEFINE NAME / GROUP; DEFINE AGE / SUM; DEFINE HEIGHT / SUM; BREAK BEFORE SEX / SUMMARIZE; RBREAK BEFORE / SUMMARIZE; COMPUTE SEX; if upcase(_break_) eq 'SEX' then do; CALL DEFINE (_ROW_,"STYLE","STYLE=[BACKGROUND = GREEN]"); SEX = 'S'; end; else if upcase(_break_) eq '_RBREAK_' then do;CALL DEFINE (_ROW_,"STYLE","STYLE=[BACKGROUND = RED]"); SEX = 'T'; end; ENDCOMP; RUN; ods html close;
Ksharp
Hi Cynthia,
The colurs for the rbreak and break that i get differ with your output. Have attached a screenshot
Since you seem to be getting the correct output . Then this may be a bug..
As Ksharp said shall have to raise a track.
Thanks Ksharp... I was already using what you have suggested .. I just wanted to know why my report was incorrect when using compute before.
Thanks a lot..
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.