Hi:
BY group processing, in general, changes the way that some procedures -- PROC REPORT, PROC PRINT and PROC TABULATE treat the data. In most cases, when you use BY group processing, you are telling the procedure to treat each by group as a separate entity -- isolated from the rest of the BY groups. This may be what's happening to your output. Sometimes BY group processing can force unwanted page breaks in your output or produce unexpected results.
Usually I find that BY group processing with PROC REPORT is not necessary, if I use BREAK processing effectively. So, that makes me wonder why you're using BY group processing instead of using BREAK processing:
[pre]
break after sc_acctype /summarize;
break after planyear /summarize;
break after location /summarize page;
[/pre]
These 3 break statements would give you a separate summary line for each break variable. PROC REPORT will also put every location on a separate page if you use the PAGE option on your BREAK statement. And, I also wonder why you're not using ReimbAmt.sum in your LINE statements.
If you are having trouble with your date fields showing in the correct date order, you might try ORDER=INTERNAL, as described here:
http://support.sas.com/faq/005/FAQ00582.html
Here's some dummy data (a small amount) and some PROC REPORT steps to compare.
[pre]
** first, make some data;
** and make the numbers small enough to add up in your head;
** to make sure that the numbers are all correct in the PROC REPORT totals;
data testdata;
length country $20 year 8 type $20 date 8 amount 8;
infile datalines;
input country $ year type $ date : date9. amount;
return;
datalines;
US 2006 XXX 01Jan2006 111
US 2006 XXX 01Jan2006 111
US 2006 XXX 01Feb2006 222
US 2006 XXX 01Feb2006 222
US 2006 YYY 01Jan2006 333
US 2006 YYY 01Jan2006 333
US 2006 YYY 01Feb2006 444
US 2006 YYY 01Feb2006 444
FR 2006 XXX 01Jan2006 111
FR 2006 XXX 01Jan2006 111
FR 2006 XXX 01Feb2006 222
FR 2006 XXX 01Feb2006 222
FR 2006 YYY 01Jan2006 333
FR 2006 YYY 01Jan2006 333
FR 2006 YYY 01Feb2006 444
FR 2006 YYY 01Feb2006 444
US 2007 XXX 01Jan2007 555
US 2007 XXX 01Jan2007 555
US 2007 XXX 01Feb2007 666
US 2007 XXX 01Feb2007 666
US 2007 YYY 01Jan2007 777
US 2007 YYY 01Jan2007 777
US 2007 YYY 01Feb2007 888
US 2007 YYY 01Feb2007 888
FR 2007 XXX 01Jan2007 555
FR 2007 XXX 01Jan2007 555
FR 2007 XXX 01Feb2007 666
FR 2007 XXX 01Feb2007 666
FR 2007 YYY 01Jan2007 777
FR 2007 YYY 01Jan2007 777
FR 2007 YYY 01Feb2007 888
FR 2007 YYY 01Feb2007 888
;
run;
options missing=' ' nodate nonumber byline;
ods listing close;
** see what regular break processing looks like;
ods pdf file='c:\temp\grp_order.pdf';
proc report data=testdata nowd
style(summary)={font_weight=bold};
title 'What BREAK processing totals look like (no BY)';
column country year type date prtdate amount;
define country / group;
define year /group;
define type /group;
define date /order format=date9. order=internal;
define prtdate /computed format=date9.;
define amount / sum;
break after country /summarize page;
break after year /summarize;
break after type /summarize;
compute before date;
holddate = date;
endcomp;
compute prtdate;
if _BREAK_ eq ' ' then prtdate=holddate;
endcomp;
run;
ods pdf close;
** now use LINE statements and BREAK processing;
ods pdf file='c:\temp\grp_order2.pdf';
proc report data=testdata nowd
style(lines)={just=r font_weight=bold};
title 'Using LINE statement at BREAK';
title2 'Using amount.sum in a compute block ';
column country year type date prtdate amount;
define country / group ;
define year /group ;
define type /group ;
define date /order format=date9. order=internal;
define prtdate /computed format=date9.;
define amount / sum;
break after country / page;
compute before date;
holddate = date;
endcomp;
compute prtdate;
if _BREAK_ eq ' ' then prtdate=holddate;
endcomp;
compute before _page_ /
style={just=c};
line 'Country = ' country $2.;
endcomp;
compute after country;
line 'Country ' country $2. ' Total: ' amount.sum comma12.;
endcomp;
compute after year;
line 'Year ' year 4. ' Total: ' amount.sum comma12.;
endcomp;
compute after type;
line 'Type ' type $3. ' Total: ' amount.sum comma12.;
endcomp;
run;
ods pdf close;
[/pre]
The first program uses standard PROC REPORT break processing -- but no BY group processing. The output shows every country on a separate page because of the PAGE option on the BREAK statement. Also, note how I use DATE as an order variable, but make a second "date" column called PRTDATE that displays the date on every line. This allows me to order by date, have the actual date value appear on every line and avoid getting these NOTE or ERROR messages in the log:
ERROR: You can only BREAK on GROUPing and ORDERing variables.
NOTE: Groups are not created because the usage of DATE is DISPLAY.
I define DATE as an ORDER variable and use a COMPUTE BEFORE block to grab the value of DATE.
I did not use NOPRINT on any of the variables so you could see that the LINE statement was being written correctly. Perhaps an approach like this is close to what you are trying to achieve.
cynthia