BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
Hi

I am using this piece of code

I want sub totals on Quantity Received, Net Goods Value and Purchase Cost only but it is showing the sub totals for date and all numeric columns

Also I want to reduce the width of the fields Quantity Received, Net Goods Value and Purchase Cost like the same I have done for 'Order Type' using flow width. The numeric field gets left aligned

Also how can I avoid getting a pagebreak after the group. The page should break only after the pagse size specified

options nobyline;
proc report data=WORK.QUERY3051 nowd headskip
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' flow width=20;
define Pi_In_Grnno / 'Internal GRN No';
define Pi_In_Grn / 'Supplier GRN No';
define Pi_In_Orderno / 'Order No' ;
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';
define Pi_In_Recqty / 'Quantity Received' ;
define Pi_In_Recgoods / 'Net Goods Value' ;
define Pi_In_Recprice / 'Net Purchase Cost' ;
break after Pi_In_Supplier /summarize skip ul ol;

compute after Pi_In_Supplier;
Pi_In_Supplier = 'SubTot of'||trim(Cf_Su_Name);
endcomp;
run;
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
In a define statement for a numeric variable, the default usage is "analysis" with a default statistic of "sum". Therefore, all of these DEFINE statements are the same:
[pre]
define sales/ 'Sales' ;
define sales/ sum 'Sales' ;
define sales/ analysis sum 'Sales' ;
define sales/ analysis 'Sales' ;
[/pre]
...and I would get a sum on the Sales column even if I had the first DEFINE statement.

So if your date variable does NOT have a usage, then you are telling SAS to use the SUM statistic for the date variable. Try explicitly putting a usage of DISPLAY for the date variable (in which case, it won't be summed up) or a usage of ORDER or GROUP:
[pre]
define Pi_In_Grndate / display 'Date Goods Received';
define Pi_In_Grndate / order 'Date Goods Received';
[/pre]

Remember that a usage of order will maintain the report as a detail report. A usage of group would "collapse" all the rows into a summarized report -- with the same date into one row (depending on the usage of the other variables in the COLUMN statement).
Cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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