BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Not sure if this is possible but here goes:

The client would like the data that is currently in the summary line displayed but would like to suppress the data in the specific column that is being summarized.

define department/order;
define Patients/order;
break before department/ol summarize;

So basically keep the data in the summary line but don't show the detail.
Thanks,
10 REPLIES 10
Cynthia_sas
SAS Super FREQ
Hi:
PROC REPORT maintains an automatic variable called _BREAK_, whose value is set only if a report row comes from a BREAK or RBREAK statement. So, for example, for BREAK BEFORE DEPARTMENT, the upper-case value of _BREAK_ would be "DEPARTMENT" -- for all the other report rows, the value of _BREAK_ would be missing or space. This means that you can test the value of the _BREAK_ value and use it to "blank out" the detail information you don't want to see.

You do not show your whole PROC REPORT code -- if department and patients are both order variables, what are the names of your variable(s) that will be summarized???? Do you have any ACROSS report items??? Are there any GROUP usage items on the report?

Generally speaking, this type of COMPUTE block would blank out the detail rows for an analysis variable called UNKNOWN_VAR, whose usage statistic is SUM:
[pre]
compute UNKNOWN_VAR;
if _BREAK_ = ' ' then do;
unknown_var.sum = .;
end;
endcomp;
[/pre]

It would be useful to see all your PROC REPORT code and to understand your destination of choice (HTML, RTF, PDF, or LISTING).

cynthia
deleted_user
Not applicable
Here is the full code:

proc report data=data.xxx missing center headline nowd nowindows headskip split='^' ;
options pageno=1 nodate center;
columns department_id department_name prov_name pts ;
define department_id/order order=internal format = BEST11. 'Department Id';
define department_name/order order=internal format = $120. 'Department Name';
efine prov_name/order order=internal format = $120. 'PCP Name';
define Pts/order order=internal format = comma11. Total Active Panel';
break after department_name /dol summarize suppress skip;
break before pts/ol summarize skip ;
run;
Cynthia_sas
SAS Super FREQ
Hi:
What variable are you summarizing at the break??? Can you show what your data looks like by making some dummy data:
[pre]
department_id, department_name, provider_name, pts
111, "Long Department Name1", "Dr. Jones", 100
111, "Long Department Name1", "Dr. Keller", 100
222, "Long Department Name2", "Dr. Lucas", 100
222, "Long Department Name2", "Dr. Meyer", 100
[/pre]

For example, it looks like PTS is the numeric variable, however you are currently treating it as an ORDER variable, so no summarizing would be done. Is there another numeric variable that you are summarizing? If you use the test data set shown above, the resulting output does not make sense. Having BREAK BEFORE PTS doesn't make sense to me. Perhaps your real data makes more sense.

FYI -- since your variable widths were going to give you issues in the LISTING window (where a line size can only be 256 and your variable widths added up to more than that), I use ODS HTML for the output file and took out options like headline, headskip, OL, DOL, and skip that are ignored by the LISTING destination.

For more information about posting code and maintaining code indenting or showing how you want a final report to be lined up, refer to this forum posting:
http://support.sas.com/forums/thread.jspa?messageID=27609毙

cynthia

[pre]
data work.xxx;
length department_name $120 prov_name $100;
infile datalines dsd dlm=',';
input department_id department_name $ prov_name $ pts;
return;
datalines;
111, "Long Department Name1", "Dr. Jones", 100
111, "Long Department Name1", "Dr. Keller", 100
222, "Long Department Name2", "Dr. Lucas", 100
222, "Long Department Name2", "Dr. Meyer", 100
;
run;

options pageno=1 nodate center;

ods listing close;
ods html file='c:\temp\testreport.html' style=sasweb;
proc report data=work.xxx missing center nowd
split='^' ;
title1 '1) Your Original Program';
columns department_id department_name prov_name pts ;
define department_id/order order=internal format = BEST11. 'Department Id';
define department_name/order order=internal format = $120. 'Department Name';
define prov_name/order order=internal format = $120. 'PCP Name';
define Pts/order order=internal format = comma11. 'Total Active Panel';
break after department_name /dol summarize suppress skip;
break before pts/ol summarize skip ;
run;

options missing = ' ';
proc report data=work.xxx missing center nowd
split='^' ;
title1 '2) Modified Program';
columns department_id department_name prov_name pts ;
define department_id/order order=internal format = BEST11. 'Department Id';
define department_name/order order=internal format = $120. 'Department Name';
define prov_name/order order=internal format = $120. 'PCP Name';
define Pts/sum format = comma11. 'Total Active Panel';
break before department_name/ summarize skip ;
compute after department_name;
line ' ';
endcomp;
compute pts;
if _break_ = ' ' then do;
pts.sum = .;
end;
endcomp;
run;

proc report data=work.xxx missing center nowd
split='^' ;
title1 '3) Showing All Detail Rows';
columns department_id department_name prov_name pts ;
define department_id/order order=internal format = BEST11. 'Department Id';
define department_name/order order=internal format = $120. 'Department Name';
define prov_name/order order=internal format = $120. 'PCP Name';
define Pts/sum format = comma11. 'Total Active Panel';
break before department_name/ summarize skip ;
compute after department_name;
line ' ';
endcomp;
run;
ods html close;
[/pre]
deleted_user
Not applicable
The report looks something like this:
department_id, department_name, provider_name, pts, measure
111, "Long Department Name1", "Dr. Jones", 100 Measure 1
Measure 2
Measure 3
111, "Long Department Name1", "Dr. Smith", 500 Measure 1
Measure 2
Measure 3


The Doctors would like the break prior to the data so the summary line above the data would say 111, "Long Department Name1", "Dr. Jones", 100

There are multiple Doctors for each department so there is going to have to be a break prior to each Doctor.

I used your suggested code:

define Pts/sum format = comma11. 'Total Active Panel';

break before prov_name/ summarize skip;
compute before prov_name;
line ' ';
endcomp;
compute pts;
if _break_ = ' ' then do;
pts.sum = .;
end;
endcomp;
RBREAK AFTER/SUMMARIZE;
run;

This gives me the summary line I need however now there are two lines above provider name with one of them blank.

Thanks for all your help on this.
j
Cynthia_sas
SAS Super FREQ
Ah, I'm beginning to understand. You did NOT have anything about MEASURE in your previous postings. While it was useful to see the report lines, even without indenting, it would be more useful to see a mockup of the input DATA and ALL your PROC REPORT code -- it's hard to figure out where MEASURE is in your COLUMN statement. Or the usage for MEASURE from seeing only the snippets you've posted.

The reason you have an extra blank like is that you formerly had SKIP in your PROC REPORT code. I got rid of the SKIP, because it is a LISTING only option and replaced it with this compute block:
[pre]
compute before prov_name;
line ' ';
endcomp;
[/pre]
...which simulates a skipped line. So if you got rid of that compute block, it would get rid of the blank line.

cynthia
deleted_user
Not applicable
Thanks that worked.
The report looks the way I want it to.
Now for the bad news.
The Pts number in the compute line is wrong.

The report I believe is adding up the pts data for every measure.
input department_id department_name $ prov_name $ pts;
111, "Long Department Name1", "Dr. Jones", 100 Measure 1
100 Measure 2
100 Measure 3
100 Measure 4

So for this example the compute line would have 400 pts for the provider when the actual pts data is only 100.

Ideally the report would look like this:

111, "Long Department Name1", "Dr. Jones", 100 (this would be the summary line before the data)
111, "Long Department Name1", "Dr. Jones",
Measure 1
Measure 2
Measure 3

Thanks for your help on this. Sorry it is so confusing.

j
Cynthia_sas
SAS Super FREQ
hi:
OK...first things first...is THIS what your data looks like???? Seeing only what your report is or should look like doesn't help, because the data in this instance might be part of the problem.

For example, if you have 100 on every observation, normally, I would assume that it is 100 for Measure 1, 100 for Measure 2, etc. I would assume that you -DID- want the 100 for every measure to be added up.

What is it about the data that's different??? Is the 100 a total for all the measures??? If so, why is the 100 on every obs???

And, could you post your WHOLE code for PROC REPORT????

cynthia
[pre]
data work.xxx;
length department_name $120 prov_name $100 measure $9;
infile datalines dsd dlm=',';
input department_id department_name $ prov_name $ pts measure $;
return;
datalines;
111, "Long Department Name1", "Dr. Jones", 100, "Measure 1"
111, "Long Department Name1", "Dr. Jones", 100, "Measure 2"
111, "Long Department Name1", "Dr. Jones", 100, "Measure 3"
111, "Long Department Name1", "Dr. Jones", 100, "Measure 4"
111, "Long Department Name1", "Dr. Keller", 100, "Measure 1"
111, "Long Department Name1", "Dr. Keller", 100, "Measure 2"
111, "Long Department Name1", "Dr. Keller", 100, "Measure 3"
111, "Long Department Name1", "Dr. Keller", 100, "Measure 4"
222, "Long Department Name2", "Dr. Lucas", 100, "Measure 1"
222, "Long Department Name2", "Dr. Lucas", 100, "Measure 2"
222, "Long Department Name2", "Dr. Lucas", 100, "Measure 3"
222, "Long Department Name2", "Dr. Lucas", 100, "Measure 4"
222, "Long Department Name2", "Dr. Meyer", 100, "Measure 1"
222, "Long Department Name2", "Dr. Meyer", 100, "Measure 2"
222, "Long Department Name2", "Dr. Meyer", 100, "Measure 3"
222, "Long Department Name2", "Dr. Meyer", 100, "Measure 4"
;
run;
[/pre]
deleted_user
Not applicable
Full code:

proc report data=colon.clinic_union_02 missing center headline nowd nowindows headskip split='^' ;
options pageno=1 nodate center;
columns department_id department_name cur_pcp_prov_id prov_name pts Measure total rate;
define department_id/order order=internal format = BEST11. 'Department Id';
define department_name/order order=internal format = $120. 'Department Name';
define cur_pcp_prov_id/order order=internal format = $10. 'PCP Id';
define prov_name/order order=internal format = $120. 'PCP Name';
define Pts/sum format = comma11. 'Total Active Panel';
define Measure/order order=internal format = $80. 'Perfomance Measure';
define total/display format =comma11. 'Number of your patients for this measure';
define rate/display format = percent11.0 'Your Performance Rate';
break before prov_name/ ;

compute pts;
if _break_ = ' ' then do;
pts.sum = .;
end;
endcomp;
RBREAK AFTER/SUMMARIZE;
run;

The Pts data is one number for each provider regardless of the measure.
A provider might have 500 patients assigned to him/her so it would be 500 for the one provider not 500 for each measure.

Thanks for all your help on this.
j
ChrisNZ
Tourmaline | Level 20
This is still not the clearest (for me at least). Can you provide a simpler example?

Do you want something like:

proc report data=sashelp.class nowindows box;
columns AGE WEIGHT ;
define AGE/group width=20 ;
define WEIGHT/sum noprint;
compute after AGE;
line 'Total Weight: ' WEIGHT.sum 3.;
endcomp;
run;
Cynthia_sas
SAS Super FREQ
Hi:
I agree with Chris...the way your data looks is still murky -- making it hard to envision what you want to do with PROC REPORT.

I don't understand your statement that:The Pts data is one number for each provider regardless of the measure

If PTS data value is just some number (like 500), then what's the point of even having it on the report??

And, if this is your COLUMN statement:
[pre]
columns department_id department_name cur_pcp_prov_id prov_name pts Measure total rate;

[/pre]

You've got some more variables in the data that you did not explain. Is it possible that you could modify the program below to show some fake data that accurately represents ALL the variables, including the fact that there's just -some number- for PTS. And, also show representative values for MEASURE, TOTAL and RATE, as well as representative values for CUR_PCP_PROV_ID??

Then, since PTS doesn't seem to be the number you want to see on the BREAK BEFORE PROV_NAME, explain what you -DO- want to see on the BREAK BEFORE line -- since you do NOT have SUMMARIZE on the BREAK statement, there's NOTHING for the BREAK statement to do.

So if you could:
1) make some fake data that accurately represents a small sample of what you're dealing with (use the program below as a model)

2) explain the purpose of PTS, MEASURE, TOTAL and RATE and explain why TOTAL and RATE are display usage (don't you want them summarized)??

3) explain the final report that you want to get for example:
"I want to show a detail report which groups my observations by xxx, yyy and zzz and puts a summary line (before/after) the first value for ???. In addition, the report should show a (GRAND TOTAL) (before/after) the whole report."

4) what is the purpose of the final RBREAK statement -- what summary numbers do you hope to see (what variables do you want to see summarized)

5) what is the purpose of the BREAK BEFORE ??

6) What is your destination of choice? RTF, PDF, HTML, LISTING?? You currently use a LOT of options that are LISTING-only options, but you should also be receiving this error message in the LOG because of the width of some of your character variables:
[pre]

ERROR: The width of department_name is not between 1 and 96. Adjust the column width or line
size.
NOTE: This affects LISTING output.
[/pre]


...that would be most helpful.

cynthia

[pre]
data work.clinic_union_02;
length department_name $120 prov_name $100 measure $9 cur_pcp_prov_id $10;
infile datalines dsd dlm=',';
input department_id department_name $ cur_pcp_prov_id $ prov_name $ pts measure $ total rate;
return;
datalines;
111, "Long Department Name1", 999, "Dr. Jones", 100, "Measure 1",11,.0100
111, "Long Department Name1", 999, "Dr. Jones", 100, "Measure 2",21,.0110
111, "Long Department Name1", 999, "Dr. Jones", 100, "Measure 3",31,.0111
111, "Long Department Name1", 999, "Dr. Jones", 100, "Measure 4",41,.0112
111, "Long Department Name1", 998, "Dr. Keller", 100, "Measure 1",12,.0200
111, "Long Department Name1", 998, "Dr. Keller", 100, "Measure 2",22,.0220
111, "Long Department Name1", 998, "Dr. Keller", 100, "Measure 3",32,.0222
111, "Long Department Name1", 998, "Dr. Keller", 100, "Measure 4",42,.0223
222, "Long Department Name2", 997, "Dr. Lucas", 100, "Measure 1",13,.0300
222, "Long Department Name2", 997, "Dr. Lucas", 100, "Measure 2",23,.0330
222, "Long Department Name2", 997, "Dr. Lucas", 100, "Measure 3",33,.0332
222, "Long Department Name2", 997, "Dr. Lucas", 100, "Measure 4",43,.0333
222, "Long Department Name2", 996, "Dr. Meyer", 100, "Measure 1",14,.0400
222, "Long Department Name2", 996, "Dr. Meyer", 100, "Measure 2",24,.0440
222, "Long Department Name2", 996, "Dr. Meyer", 100, "Measure 3",34,.0442
222, "Long Department Name2", 996, "Dr. Meyer", 100, "Measure 4",44,.0443
;
run;

options pageno=1 nodate center;

ods listing close;
ods html file='c:\temp\clinic_union.html' style=sasweb;
proc report data=work.clinic_union_02 missing center nowd split='^' ;
title 'The Report with ALL the Variables';
columns department_id department_name cur_pcp_prov_id prov_name pts Measure total rate;
define department_id/order order=internal format = BEST11. 'Department Id';
define department_name/order order=internal format = $120. 'Department Name';
define cur_pcp_prov_id/order order=internal format = $10. 'PCP Id';
define prov_name/order order=internal format = $120. 'PCP Name';
define Pts/sum format = comma11. 'Total Active Panel';
define Measure/order order=internal format = $80. 'Perfomance Measure';
define total/display format =comma11. 'Number of your patients for this measure';
define rate/display format = percent11.0 'Your Performance Rate';
break before prov_name/ ;

compute pts;
if _break_ = ' ' then do;
pts.sum = .;
end;
endcomp;
RBREAK AFTER/SUMMARIZE;
run;

ods html close;
[/pre]

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 1559 views
  • 0 likes
  • 3 in conversation