DATA Step, Macro, Functions and more

Proc Report Supressing Summarize

Reply
Contributor
Posts: 45

Proc Report Supressing Summarize

 

proc report data=results2;
column Name Agencyorcompany State location_state ans_per;
define Location_state / group;
define Agencyorcompany / 'Agency or Compary';
define location_state / 'IP Location';
define ans_per / 'Percent Answered' f=percent7.0;
break after Location_state/summarize skip page;
compute after Location_state;
Location_state="Total %";
endcomp;
run;

 

 

Hello All,

 

I am running the code above but am running into issues with the summarize option. In the above code I am summarizing percentages by state. A few of the group only have one value so I would like to avoid summarizing those group. Any idea how I would supress the summary variable for those groups? I could use proc print but it forces me include the grand total which I do not want. 

 

Thanks

Valued Guide
Posts: 632

Re: Proc Report Supressing Summarize

You can control the values to be displayed in a compute block.

options missing=' ';
proc report data=sashelp.class(where=(age gt 14));
   column age name  height=ht_n height;
   define age / order;
   define name / display;
   define ht_n / n noprint;
   define height / mean;
   break after age / summarize;
   compute after age;
      if ht_n <2 then do;
         height.mean=.;
         age=.;
      end;
   endcomp;
   run;

There is only one 16 year old in the CLASS data.

Contributor
Posts: 45

Re: Proc Report Supressing Summarize

data results2;
	set results2;
	temp=location_state;
proc report data=results2;
	column Name Agencyorcompany State location_state temp ans_per ans_per=ans_per_n;
	define ans_per_n / n noprint;
	define Agencyorcompany / 'Agency or Compary';
	define location_state / group noprint;
	define temp / 'IP Location State';
	define ans_per / 'Percent Answered' f=percent7.0 sum;
	break after Location_state/summarize skip page;
	compute after Location_state;
		temp="Total %";
		if ans_per_n < 2 then do;
			ans_per.sum=.;
			temp="";
		end;
	endcomp;
run;

Thanks, that almost got me where I want. I made it so that if ans_per has only one row the summarize row displays nothing. Is there a way to make it so there is no summarize row? 

 

Since I am using the page option each group is printing out as an individual table and would like to remove the summarize row for groups with only one row.

Valued Guide
Posts: 632

Re: Proc Report Supressing Summarize

I can't test or research right now but you might be able to add something like the following to your compute block.

call define(_row_,'style','style={cellheight=.1in}');

This won't solve the problem.  You will need to specify some other attributes perhaps eliminate the margins.

Ask a Question
Discussion stats
  • 3 replies
  • 122 views
  • 1 like
  • 2 in conversation