<?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 Grouping columns in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46888#M6110</link>
    <description>I have four columns named prd_grp,prd-subgroup,prd_desc and loan_amount.&lt;BR /&gt;
The data is as follows:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
prd_grp		prd_subgroup    prd_desc     		loan_amount&lt;BR /&gt;
&lt;BR /&gt;
ASSETS		All Other	       Loans			234  &lt;BR /&gt;
ASSETS		All Other 	       abc 			345&lt;BR /&gt;
ASSETS		All Other 	       Quoted Shares Held	213&lt;BR /&gt;
LIABILIITES	Deposits 	       Current Deposits	                435	&lt;BR /&gt;
LIABILIITES	Deposits 	       Fixed			325&lt;BR /&gt;
LIABILIITES	Deposits          NIDs &amp;amp; Repos		256&lt;BR /&gt;
LIABILIITES	Deposits 	      Savings		218&lt;BR /&gt;
&lt;BR /&gt;
Below is the output I needed&lt;BR /&gt;
&lt;BR /&gt;
Item			Loan_amount&lt;BR /&gt;
&lt;BR /&gt;
ASSETS			&lt;BR /&gt;
All Other		&lt;BR /&gt;
Loans			234			&lt;BR /&gt;
abc			345&lt;BR /&gt;
Quoted Shares Held	                213&lt;BR /&gt;
Total			692&lt;BR /&gt;
LIABILIITES&lt;BR /&gt;
Deposits&lt;BR /&gt;
Current Deposits	                435&lt;BR /&gt;
Fixed			325&lt;BR /&gt;
NIDs &amp;amp; Repos		256&lt;BR /&gt;
Savings			218&lt;BR /&gt;
Total			1234&lt;BR /&gt;
&lt;BR /&gt;
Can anyone help me on this.&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Siddhartha</description>
    <pubDate>Wed, 08 Dec 2010 14:11:51 GMT</pubDate>
    <dc:creator>Siddhartha</dc:creator>
    <dc:date>2010-12-08T14:11:51Z</dc:date>
    <item>
      <title>Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46888#M6110</link>
      <description>I have four columns named prd_grp,prd-subgroup,prd_desc and loan_amount.&lt;BR /&gt;
The data is as follows:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
prd_grp		prd_subgroup    prd_desc     		loan_amount&lt;BR /&gt;
&lt;BR /&gt;
ASSETS		All Other	       Loans			234  &lt;BR /&gt;
ASSETS		All Other 	       abc 			345&lt;BR /&gt;
ASSETS		All Other 	       Quoted Shares Held	213&lt;BR /&gt;
LIABILIITES	Deposits 	       Current Deposits	                435	&lt;BR /&gt;
LIABILIITES	Deposits 	       Fixed			325&lt;BR /&gt;
LIABILIITES	Deposits          NIDs &amp;amp; Repos		256&lt;BR /&gt;
LIABILIITES	Deposits 	      Savings		218&lt;BR /&gt;
&lt;BR /&gt;
Below is the output I needed&lt;BR /&gt;
&lt;BR /&gt;
Item			Loan_amount&lt;BR /&gt;
&lt;BR /&gt;
ASSETS			&lt;BR /&gt;
All Other		&lt;BR /&gt;
Loans			234			&lt;BR /&gt;
abc			345&lt;BR /&gt;
Quoted Shares Held	                213&lt;BR /&gt;
Total			692&lt;BR /&gt;
LIABILIITES&lt;BR /&gt;
Deposits&lt;BR /&gt;
Current Deposits	                435&lt;BR /&gt;
Fixed			325&lt;BR /&gt;
NIDs &amp;amp; Repos		256&lt;BR /&gt;
Savings			218&lt;BR /&gt;
Total			1234&lt;BR /&gt;
&lt;BR /&gt;
Can anyone help me on this.&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Siddhartha</description>
      <pubDate>Wed, 08 Dec 2010 14:11:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46888#M6110</guid>
      <dc:creator>Siddhartha</dc:creator>
      <dc:date>2010-12-08T14:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46889#M6111</link>
      <description>Hi:&lt;BR /&gt;
  This looks like the kind of output that you could create with PROC REPORT -- you'd put PRD_GRP and PRD_SUBGROUP on the COLUMN statement, but use the NOPRINT option on the DEFINE statement. &lt;BR /&gt;
 &lt;BR /&gt;
  Then, you could put the PRD_GRP and PRD_SUBGRP into LINE statements in a COMPUTE BEFORE block in order to write the "ASSETS" or "LIABILITIES" above each group. Then you'd have an RBREAK AFTER statement to get the Total summary line at the bottom of the report.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
 &lt;BR /&gt;
It would also be useful to know what your destination of interest is: ODS HTML, ODS RTF, ODS PDF????</description>
      <pubDate>Wed, 08 Dec 2010 15:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46889#M6111</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-12-08T15:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46890#M6112</link>
      <description>I want this output in HTML format&lt;BR /&gt;
&lt;BR /&gt;
Please help me on this.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Siddhartha</description>
      <pubDate>Thu, 09 Dec 2010 03:35:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46890#M6112</guid>
      <dc:creator>Siddhartha</dc:creator>
      <dc:date>2010-12-09T03:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46891#M6113</link>
      <description>Hi:&lt;BR /&gt;
   If you want ODS HTML output, you will probably use syntax like this to invoke ODS:&lt;BR /&gt;
[pre]&lt;BR /&gt;
ods html file='c:\temp\use_report.html' style=sasweb;&lt;BR /&gt;
   ... your code ...&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                  &lt;BR /&gt;
Have you used PROC REPORT before? If not, I recommend these user-group papers on the basics of PROC REPORT. &lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi25/25/hands/25p14" target="_blank"&gt;http://www2.sas.com/proceedings/sugi25/25/hands/25p14&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi25/25/hands/25p148.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi25/25/hands/25p148.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
Then, learn more about the COMPUTE block:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2008/031-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/031-2008.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2008/188-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/188-2008.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2007/242-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/242-2007.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2007/025-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/025-2007.pdf&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
And some other, more advanced examples:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2007/025-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/025-2007.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://support.sas.com/resources/papers/proceedings10/133-2010.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings10/133-2010.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
In addition, this  PDF book, a version of the original PROC REPORT non-interactive mode documentation -- still contains some of the best explanations of how PROC REPORT operates.&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/onlinedoc/v82/techreport_p258.pdf" target="_blank"&gt;http://support.sas.com/documentation/onlinedoc/v82/techreport_p258.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Also, there are previous forum postings on COMPUTE blocks -- with code samples, such as this one:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=6755ᩣ" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=6755ᩣ&lt;/A&gt; &lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 09 Dec 2010 04:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46891#M6113</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-12-09T04:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46892#M6114</link>
      <description>Hi.&lt;BR /&gt;
You must change your data's structure firstly.&lt;BR /&gt;
This will waste some times.Good Luck.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data op;&lt;BR /&gt;
 input prd_grp : $20. prd_subgroup &amp;amp; $20. prd_desc &amp;amp; $20. loan_amount ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
ASSETS All Other   Loans    234&lt;BR /&gt;
ASSETS All Other   abc    345&lt;BR /&gt;
ASSETS All Other   Quoted Shares Held    213&lt;BR /&gt;
LIABILIITES Deposits   Current Deposits    435&lt;BR /&gt;
LIABILIITES Deposits   Fixed   325&lt;BR /&gt;
LIABILIITES Deposits   NIDs &amp;amp; Repos    256&lt;BR /&gt;
LIABILIITES Deposits   Savings    218&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data op;&lt;BR /&gt;
 set op;&lt;BR /&gt;
 if prd_grp eq lag(prd_grp) and prd_subgroup eq lag(prd_subgroup) &lt;BR /&gt;
    then call missing ( prd_grp,prd_subgroup);&lt;BR /&gt;
run;&lt;BR /&gt;
data temp(where=(item is not missing));&lt;BR /&gt;
 set op;&lt;BR /&gt;
 item=prd_grp;output;&lt;BR /&gt;
 item=prd_subgroup;output;&lt;BR /&gt;
 item=prd_desc; _loan_amount=loan_amount;output;&lt;BR /&gt;
 keep item _loan_amount  prd_subgroup;&lt;BR /&gt;
run;&lt;BR /&gt;
data report;&lt;BR /&gt;
 set temp;&lt;BR /&gt;
 retain id;&lt;BR /&gt;
 if not missing(prd_subgroup) then id=prd_subgroup;&lt;BR /&gt;
 drop prd_subgroup;&lt;BR /&gt;
run;&lt;BR /&gt;
options missing=' ';&lt;BR /&gt;
ods html file='c:\temp\report.html' style=sasweb;&lt;BR /&gt;
proc report data=report nowd  ;&lt;BR /&gt;
 column id item _loan_amount;&lt;BR /&gt;
 define id /group noprint;&lt;BR /&gt;
 define item /display;&lt;BR /&gt;
 define _loan_amount / analysis sum;&lt;BR /&gt;
 compute after id;&lt;BR /&gt;
  item='Total';&lt;BR /&gt;
  line '   ';&lt;BR /&gt;
 endcomp;&lt;BR /&gt;
 break after id /summarize ;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 09 Dec 2010 08:58:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46892#M6114</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-09T08:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46893#M6115</link>
      <description>Hi:&lt;BR /&gt;
  In fact, PROC REPORT -can- produce this report without restructuring the data because of the ability to use the NOPRINT options. The PRD_GRP and PRD_SUBGROUP items can be defined as GROUP or ORDER (with NOPRINT), the LINE statement will be able to use those 2 items in a COMPUTE BEFORE group.&lt;BR /&gt;
 &lt;BR /&gt;
  An example, using differently named variables is shown below.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data repdata;&lt;BR /&gt;
  length grpvar subgrp desc $20;&lt;BR /&gt;
  infile datalines dlm="," dsd;&lt;BR /&gt;
  input grpvar $ subgrp $ desc $ amount;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
"GROUP1", "SUBGRP1","One",  234 &lt;BR /&gt;
"GROUP1", "SUBGRP1","Two",  345&lt;BR /&gt;
"GROUP1", "SUBGRP1","Three",  678&lt;BR /&gt;
"GROUP2", "SUBGRP2","Ten",  911 &lt;BR /&gt;
"GROUP2", "SUBGRP2","Eleven",  345&lt;BR /&gt;
"GROUP2", "SUBGRP2","Twelve",  987&lt;BR /&gt;
"GROUP2", "SUBGRP2","Something",  432&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
           &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods html file='c:\temp\repdata.html' style=sasweb;&lt;BR /&gt;
              &lt;BR /&gt;
proc report data=repdata nowd;&lt;BR /&gt;
  column grpvar subgrp desc amount;&lt;BR /&gt;
  define grpvar / order  noprint;&lt;BR /&gt;
  define subgrp / order noprint ;&lt;BR /&gt;
  define desc / order order=data 'Item';&lt;BR /&gt;
  define amount / sum 'Loan Amount';&lt;BR /&gt;
  rbreak after / summarize;&lt;BR /&gt;
  compute after;&lt;BR /&gt;
    desc = 'Total';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before subgrp /&lt;BR /&gt;
    style=Header{just=l};&lt;BR /&gt;
    line grpvar $20.;&lt;BR /&gt;
    line subgrp $20.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 09 Dec 2010 13:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46893#M6115</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-12-09T13:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping columns</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46894#M6116</link>
      <description>Yes.Cynthia&lt;BR /&gt;
'line' statement is very useful.Education!&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data op;&lt;BR /&gt;
 input grpvar : $20. subgrp &amp;amp; $20. desc &amp;amp; $20. amount ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
ASSETS All Other   Loans    234&lt;BR /&gt;
ASSETS All Other   abc    345&lt;BR /&gt;
ASSETS All Other   Quoted Shares Held    213&lt;BR /&gt;
LIABILIITES Deposits   Current Deposits    435&lt;BR /&gt;
LIABILIITES Deposits   Fixed   325&lt;BR /&gt;
LIABILIITES Deposits   NIDs &amp;amp; Repos    256&lt;BR /&gt;
LIABILIITES Deposits   Savings    218&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
           &lt;BR /&gt;
ods listing close;&lt;BR /&gt;
ods html file='c:\temp\repdata.html' style=journal;&lt;BR /&gt;
              &lt;BR /&gt;
proc report data=op nowd;&lt;BR /&gt;
  column grpvar subgrp desc amount;&lt;BR /&gt;
  define grpvar / group  noprint;&lt;BR /&gt;
  define subgrp / group noprint ;&lt;BR /&gt;
  define desc / order order=data 'Item';&lt;BR /&gt;
  define amount / sum 'Loan Amount';&lt;BR /&gt;
  break after subgrp/ summarize;&lt;BR /&gt;
  compute after subgrp;&lt;BR /&gt;
    desc = 'Total';&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before subgrp /&lt;BR /&gt;
    style=Header{just=l};&lt;BR /&gt;
    line grpvar $20.;&lt;BR /&gt;
    line subgrp $20.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
ods listing;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Fri, 10 Dec 2010 02:30:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Grouping-columns/m-p/46894#M6116</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-12-10T02:30:18Z</dc:date>
    </item>
  </channel>
</rss>

