BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
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 --------- ---------
1 REPLY 1
Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 939 views
  • 0 likes
  • 2 in conversation