<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Getting all sub totals of numeric and date fields in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-all-sub-totals-of-numeric-and-date-fields/m-p/4539#M1455</link>
    <description>Hi:&lt;BR /&gt;
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:&lt;BR /&gt;
[pre]&lt;BR /&gt;
define sales/ 'Sales' ;&lt;BR /&gt;
define sales/ sum 'Sales' ;&lt;BR /&gt;
define sales/ analysis sum 'Sales' ; &lt;BR /&gt;
define sales/ analysis 'Sales' ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
...and I would get a sum on the Sales column even if I had the first DEFINE statement.&lt;BR /&gt;
&lt;BR /&gt;
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:&lt;BR /&gt;
[pre]&lt;BR /&gt;
define Pi_In_Grndate / display  'Date Goods Received';&lt;BR /&gt;
define Pi_In_Grndate / order 'Date Goods Received';&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
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).&lt;BR /&gt;
Cynthia</description>
    <pubDate>Fri, 07 Sep 2007 18:46:35 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-09-07T18:46:35Z</dc:date>
    <item>
      <title>Getting all sub totals of numeric and date fields</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-all-sub-totals-of-numeric-and-date-fields/m-p/4538#M1454</link>
      <description>Hi &lt;BR /&gt;
&lt;BR /&gt;
I am using this piece of code&lt;BR /&gt;
&lt;BR /&gt;
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&lt;BR /&gt;
&lt;BR /&gt;
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&lt;BR /&gt;
&lt;BR /&gt;
Also how can I avoid getting a pagebreak after the group. The page should break only after the pagse size specified&lt;BR /&gt;
&lt;BR /&gt;
options nobyline;&lt;BR /&gt;
proc report data=WORK.QUERY3051 nowd headskip&lt;BR /&gt;
	style(summary)=Header;&lt;BR /&gt;
	by Pi_In_Supplier Cf_Su_Name;&lt;BR /&gt;
	title j=l 'SUPPLIER : #byval(Pi_In_Supplier)      #byval(Cf_Su_Name)';&lt;BR /&gt;
	&lt;BR /&gt;
	column  Pi_In_Supplier Cf_Su_Name Gb_Br_Name &lt;BR /&gt;
			Pi_In_Grnno Pi_In_Grn Pi_In_Orderno Pi_In_Ordtype Pi_In_Partno &lt;BR /&gt;
			Pi_In_Grndate Pi_In_Recqty Pi_In_Recgoods Pi_In_Recprice;&lt;BR /&gt;
	define Pi_In_Supplier / group noprint ;&lt;BR /&gt;
	define Cf_Su_Name / group noprint ;&lt;BR /&gt;
	define Gb_Br_Name / 'Branch' flow width=20;&lt;BR /&gt;
	define Pi_In_Grnno / 'Internal GRN No';&lt;BR /&gt;
	define Pi_In_Grn / 'Supplier GRN No';&lt;BR /&gt;
	define Pi_In_Orderno / 'Order No' ;&lt;BR /&gt;
	define Pi_In_Ordtype / 'Order Type' 	flow width=5;&lt;BR /&gt;
	define Pi_In_Partno / 'Product Code'	flow width=10;&lt;BR /&gt;
	define Pi_In_Grndate / 'Date Goods Received';&lt;BR /&gt;
	define Pi_In_Recqty / 'Quantity Received'	;&lt;BR /&gt;
	define Pi_In_Recgoods / 'Net Goods Value'	;&lt;BR /&gt;
	define Pi_In_Recprice / 'Net Purchase Cost'	;&lt;BR /&gt;
	break after Pi_In_Supplier /summarize skip ul ol;&lt;BR /&gt;
&lt;BR /&gt;
	compute after Pi_In_Supplier;&lt;BR /&gt;
		Pi_In_Supplier = 'SubTot of'||trim(Cf_Su_Name);&lt;BR /&gt;
	endcomp;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 05 Sep 2007 09:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-all-sub-totals-of-numeric-and-date-fields/m-p/4538#M1454</guid>
      <dc:creator>SanjayM</dc:creator>
      <dc:date>2007-09-05T09:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Getting all sub totals of numeric and date fields</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-all-sub-totals-of-numeric-and-date-fields/m-p/4539#M1455</link>
      <description>Hi:&lt;BR /&gt;
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:&lt;BR /&gt;
[pre]&lt;BR /&gt;
define sales/ 'Sales' ;&lt;BR /&gt;
define sales/ sum 'Sales' ;&lt;BR /&gt;
define sales/ analysis sum 'Sales' ; &lt;BR /&gt;
define sales/ analysis 'Sales' ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
...and I would get a sum on the Sales column even if I had the first DEFINE statement.&lt;BR /&gt;
&lt;BR /&gt;
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:&lt;BR /&gt;
[pre]&lt;BR /&gt;
define Pi_In_Grndate / display  'Date Goods Received';&lt;BR /&gt;
define Pi_In_Grndate / order 'Date Goods Received';&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
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).&lt;BR /&gt;
Cynthia</description>
      <pubDate>Fri, 07 Sep 2007 18:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Getting-all-sub-totals-of-numeric-and-date-fields/m-p/4539#M1455</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-09-07T18:46:35Z</dc:date>
    </item>
  </channel>
</rss>

