<?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: Proc print/Report BY group Totaling in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2755#M1196</link>
    <description>many thanks, it works as suggested.</description>
    <pubDate>Wed, 11 Apr 2007 04:52:03 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-04-11T04:52:03Z</dc:date>
    <item>
      <title>Proc print/Report BY group Totaling</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2753#M1194</link>
      <description>For the code below, how I do get the BY group totals? Buy_Sell totals is the sum of both 'BUY' as well as 'SELL' currently, while i'd like the totals to be of all BUY separately and all 'SELL' separately.&lt;BR /&gt;
&lt;BR /&gt;
I could do it using first.Buy_Sell logic(an example is there on your support site) but I want to know whether it's easier to do that using one of proc print/report/tabulate or any other proc you can suggest.&lt;BR /&gt;
&lt;BR /&gt;
Shanks,&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data trades;&lt;BR /&gt;
/* read the data */&lt;BR /&gt;
informat trade_date date9.;&lt;BR /&gt;
length symbol $12;&lt;BR /&gt;
input trade_date&lt;BR /&gt;
symbol $  &lt;BR /&gt;
quantity &lt;BR /&gt;
Buy_Sell $&lt;BR /&gt;
Price&lt;BR /&gt;
Brokerage&lt;BR /&gt;
Service_Tax&lt;BR /&gt;
STT&lt;BR /&gt;
;&lt;BR /&gt;
/* calculate the costs */&lt;BR /&gt;
buy_sell_total=quantity * price;&lt;BR /&gt;
nett_total= buy_sell_total + Brokerage + Service_Tax + STT;&lt;BR /&gt;
cards;&lt;BR /&gt;
22-Feb-07	HLLLTDEQNR	10	Buy	 196.4	15	 1.84	2.46&lt;BR /&gt;
22-Feb-07	ITCLTDEQNR	10	Buy	 175.75	15	 1.84	2.2&lt;BR /&gt;
22-Feb-07	TINCOIEQNR	50	Buy	 53.2	15	 1.84	3.33&lt;BR /&gt;
24-Feb-07	IFCLTDEQNR	20	Buy	 30.25	15	 1.84	1&lt;BR /&gt;
26-Feb-07	HLLLTDEQNR	10	Sell 174	15	 1.84	2.46&lt;BR /&gt;
01-Mar-07	DABINDEQNR	10	Buy	 96	    15	 1.84	1&lt;BR /&gt;
01-Mar-07	RELPETEQNR	20	Buy	 66.6	15	 1.84	2&lt;BR /&gt;
28-Mar-07	RELPETEQNR	50	Buy	 74.5	18.5 2.26	5&lt;BR /&gt;
09-Mar-07	ITCLTDEQNR	20	Buy	 159	16	 1.96	4&lt;BR /&gt;
30-MAR-07   ITCLTDEQNR  20  Buy  151    15.20 1.86  4&lt;BR /&gt;
;;;;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=trades;&lt;BR /&gt;
by Buy_sell trade_date;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=trades noobs;&lt;BR /&gt;
var trade_date symbol brokerage Service_tax STT buy_sell_total nett_total;&lt;BR /&gt;
format trade_date ddmmyyd9.;&lt;BR /&gt;
sum brokerage Service_tax STT buy_sell_total nett_total;&lt;BR /&gt;
by buy_sell;&lt;BR /&gt;
*id Buy_sell;&lt;BR /&gt;
sumby Buy_sell;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 10 Apr 2007 04:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2753#M1194</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-04-10T04:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc print/Report BY group Totaling</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2754#M1195</link>
      <description>Hi!&lt;BR /&gt;
  Try this PROC REPORT code. The NOBYLINE option allows you to suppress the BYLINE and use the value of the by variable (BUY_SELL) in the SAS TITLE statement.&lt;BR /&gt;
 &lt;BR /&gt;
For help with the PROC REPORT code, consult the SAS on-line doc and look for the topic "Concepts: REPORT Procedure".&lt;BR /&gt;
 &lt;BR /&gt;
Good luck!&lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
options nobyline;&lt;BR /&gt;
proc report data=trades nowd;&lt;BR /&gt;
  title 'Report for: #byval1';&lt;BR /&gt;
  by buy_sell;&lt;BR /&gt;
  column buy_sell&lt;BR /&gt;
         trade_date symbol brokerage Service_tax &lt;BR /&gt;
         STT buy_sell_total nett_total;&lt;BR /&gt;
  define buy_sell /group noprint;&lt;BR /&gt;
  define trade_date/display f=ddmmyyd9. "Trade/Date";&lt;BR /&gt;
  define symbol /display "Symbol";&lt;BR /&gt;
  define brokerage /sum "Brokerage" width=9;&lt;BR /&gt;
  define Service_tax /sum "Svc Tax";&lt;BR /&gt;
  define STT /sum "STT";&lt;BR /&gt;
  define buy_sell_total /sum "Buy-Sell/Total" f=dollar14.2;&lt;BR /&gt;
  define nett_total /sum "Nett/Total" f=dollar14.2;&lt;BR /&gt;
  break after buy_sell /summarize dol dul;&lt;BR /&gt;
run;&lt;BR /&gt;
     &lt;BR /&gt;
options byline;&lt;BR /&gt;
title;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 10 Apr 2007 15:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2754#M1195</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-04-10T15:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc print/Report BY group Totaling</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2755#M1196</link>
      <description>many thanks, it works as suggested.</description>
      <pubDate>Wed, 11 Apr 2007 04:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-print-Report-BY-group-Totaling/m-p/2755#M1196</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-04-11T04:52:03Z</dc:date>
    </item>
  </channel>
</rss>

