The SAS Output Delivery System and reporting techniques

How to get values repeating and not supressed for groups

Reply
Frequent Contributor
Posts: 97

How to get values repeating and not supressed for groups

The following code shows the output summarised on Product and Grand total for Region

proc report data=sashelp.shoes;
COLUMN Region Product Subsidiary Sales;
DEFINE Region / group width=20;
DEFINE product / group width=20;
DEFINE Sales / ANALYSIS SUM;
*break after Product / summarize;

COMPUTE AFTER Product ;
LINE @59 'TOTAL'
@89 Sales.Sum ;
LINE '';
ENDCOMP;
COMPUTE AFTER ;
LINE @59 'GRAND TOTAL'
@89 Sales.Sum;
LINE '';
ENDCOMP;

run;

How can I get the Region and Product values repeating and not supressed.
SAS Super FREQ
Posts: 8,742

Re: How to get values repeating and not supressed for groups

Hi:
Basically, suppression of repeating values is what comes with ORDER and GROUP usage. You can't make them work any differently. However, you can create a new report item that is assigned the value for region and group. But, to do that you have to "grab" those values in a COMPUTE BEFORE ... block and then save them in a temporary variable. Then you use the temporary variable to assign a value to the column that shows up on the report.

cynthia
[pre]
proc report data=sashelp.shoes nowd;
COLUMN Region newreg Product newprod Subsidiary Sales;
DEFINE Region / group width=20 noprint;
define newreg /computed 'Region';

DEFINE product / group width=20 noprint;
define newprod /computed 'Product';

DEFINE Sales / ANALYSIS SUM;
*break after Product / summarize;

compute before Region;
** "grab" the region value before it is suppressed;
holdreg = Region;
endcomp;
compute newreg / character length=20;
newreg = holdreg;
endcomp;

compute before Product;
** "grab" the product value before it is suppressed;
holdprod = Product;
endcomp;
compute newprod/ character length=20;
newprod = holdprod;
endcomp;

COMPUTE AFTER Product ;
LINE @59 'TOTAL'
@89 Sales.Sum ;
LINE '';
ENDCOMP;
COMPUTE AFTER ;
LINE @59 'GRAND TOTAL'
@89 Sales.Sum;
LINE '';
ENDCOMP;

run;
[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 108 views
  • 0 likes
  • 2 in conversation