Desktop productivity for business analysts and programmers

Problem using compute

Reply
Frequent Contributor
Posts: 97

Problem using compute

How do I get Customised Total labels as you showed in your last post.
I tried compute but doesnt work.

Group is on Supplier and then on Branch
So the total label of Group and Branch should be as
TOTAL of : 100

After supplier group break it should be
TOTAL of : 1000

And after all suppliers

GRAND TOTAL : 10000

Please


proc report data=WORK.QUERY3051 nowd headskip COLWIDTH=5
style(summary)=Header;
by Pi_In_Supplier Cf_Su_Name;
title j=l 'SUPPLIER : #byval(Pi_In_Supplier) #byval(Cf_Su_Name)';

column Pi_In_Supplier 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 Pi_In_Supplier / group noprint ;
define Cf_Su_Name / group noprint ;
define Gb_Br_Name / 'Branch' group flow width=20;
define Pi_In_Grnno / 'Internal GRN No';
define Pi_In_Grn / 'Supplier GRN No';
define Pi_In_Orderno / 'Order No' group ;
define Pi_In_Ordtype / 'Order Type' flow width=5;
define Pi_In_Partno / 'Product Code' flow width=10;
define Pi_In_Grndate / 'Date Goods Received' group;
define Pi_In_Recqty / 'Quantity Received' SUM ;
define Pi_In_Recgoods / 'Net Goods Value' SUM ;
define Pi_In_Recprice / 'Net Purchase Cost' SUM ;

break after Pi_In_Supplier /summarize skip ul ol;
break after Gb_Br_Name /summarize skip ul ol;


run;
SAS Super FREQ
Posts: 8,719

Re: Problem using compute

Hi,
This forum posting
http://support.sas.com/forums/thread.jspa?threadID=1840&tstart=0
showed how to change the text at the summary line.

The PROC REPORT documentation talks about how PROC REPORT processes from left to right. So if you want to have this computation for newvar:
[pre]
comput newvar;
newvar = var2.sum + var4.sum;
endcomp;
[/pre]

Then you have to place newvar3 AFTER var4:
[pre]
column var1 var2 newvar var4; < ---- WRONG
column var1 var2 var4 newvar; < --- RIGHT
[/pre]

This same concept applies to a COMPUTE block...if you have this:
[pre]
column grpvar var1 var2 var4 newvar ;
[/pre]
And, if grpvar is a NOPRINT variable, then the variable you need to change at the summary line is the VAR1 variable "slot" or cell.

For more help with PROC REPORT syntax and making the changes you want, you might consider contacting Tech Support.

cynthia
Frequent Contributor
Posts: 97

Re: Problem using compute

Hello,
I dont want to compute new column but i want to customize my sub totals and Grand totals.
So how should i go ahaed doing that,my code is given below.


options nobyline nocenter;

proc report data=WORK.QUERY3051 nowd split='*' colwidth=20 spacing=2 headskip;

by Pi_In_Supplier Gb_Br_Name ;

title1 ' Supplier Report ' ;
title2 'SUPPLIER : #byval(Pi_In_Supplier) ' ;

column Pi_In_Supplier 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 Pi_In_Supplier / group noprint width=20;
*define Cf_Su_Name / group noprint ;
define Gb_Br_Name / 'Branch' group flow width=20;
define Pi_In_Grnno / 'Internal GRN No ' ;
define Pi_In_Grn / 'Supplier GRN No' ;
define Pi_In_Orderno / 'Order No' order ;
define Pi_In_Ordtype / 'Order Type' flow width=5;
define Pi_In_Partno / 'Product Code' flow width=10;
define Pi_In_Grndate / 'Date Goods Received' 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 Pi_In_Supplier /summarize skip ul ol;
rbreak after / ol ul summarize;
*break after Gb_Br_Name /summarize skip ul ol;

compute after Pi_In_Supplier;
Pi_In_Supplier= Pi_In_Supplier || 'sub Total';

endcomp;

run;


Using this code I am not able to display subtotal for each supplier and grand total for each supplier .
SAS Super FREQ
Posts: 8,719

Re: Problem using compute

Ask a Question
Discussion stats
  • 3 replies
  • 118 views
  • 0 likes
  • 2 in conversation