Desktop productivity for business analysts and programmers

problem in displaying customize Totals and sub totals

Reply
Frequent Contributor
Posts: 97

problem in displaying customize Totals and sub totals

Want to display total for supplier name in my report.
Below is the code through which i am not able to display the customize total..

proc report data=WORK.QUERY3051 nowd headskip split='*' spacing=1;
by Cf_Su_Name Gb_Br_Name;
title2 'SUPPLIER : #byval(Cf_Su_Name) ' ;
column Cf_Su_Name Gb_Br_Name
Pi_In_Grnno Pi_In_Grn Pi_In_Orderno Pi_In_Ordtype Pi_In_Partno
Pi_In_Grndate Pi_In_Recqty Pi_In_Recgoods Pi_In_Recprice;
define Cf_Su_Name /group noprint order=formatted ;
define Gb_Br_Name / group order=formatted;
define Pi_In_Orderno / order;
define Pi_In_Ordtype / 'Order*Type' flow width=5;
define Pi_In_Grndate / order;
define Pi_In_Recqty / 'Quantity*Received' SUM format=8.;
define Pi_In_Recgoods / 'Net*Goods*Value' SUM format=comma16.2;
define Pi_In_Recprice / 'Net*Purchase*Cost' SUM format=comma16.2;
break after Gb_Br_Name / summarize OL skip;
rbreak after / summarize;
compute after ;
Cf_Su_Name = 'Total for' || Cf_Su_Name;
endcomp;


run;

Can you modify the code to display below layout.
i am displaying the report layout

Supplier:xyz
Branch GRN Order_type date quantity value
abc
abc subtotal --------- ---------
Total for xyz --------- ---------
SAS Super FREQ
Posts: 8,819

Re: problem in displaying customize Totals and sub totals

Hi:
Cf_Su_Name is a NOPRINT variable. So changing its value in the COMPUTE block is not going to work (as you discovered).

If you look at this previous forum posting:
http://support.sas.com/forums/thread.jspa?threadID=1840&tstart=0 and review and run ANY of the Example programs, you will notice that REGION in the programs is defined as a NOPRINT variable.

So, in the COMPUTE block:
[pre]
compute after region;
if region = 'Central America/Caribbean' then region = 'C Amer/Carib';
else if region = 'Western Europe' then region = 'W Eur';
else if region = 'Eastern Europe' then region = 'E Eur';
product = trim(region)|| ' SubTot';
endcomp;
[/pre]

Notice that the COMPUTE block will be executed at the break for REGION, but, the report item that is being "renamed" is PRODUCT ... not REGION. Because PRODUCT is the first "visible" report item on the report.

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 97 views
  • 0 likes
  • 2 in conversation