<?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: SAS Custom Sub Grouping in proc Report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713506#M220137</link>
    <description>&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the real code snippet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc report data=RESULT 	
	column   ORDER COLOR AMOUNT

	define ORDER/ 'ORDER'  noprint group   order order = DATA group; 
	define COLOR/ 'COLOR'   order order = DATA group ; 
	define AMOUNT/ 'AMOUNT';

	break after ORDER/ summarize;
	compute after ORDER;
	  call define('ORDER','style','style=Header{pretext="SubTotal " tagattr="Type:String"}');
	endcomp;
	run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2021 22:11:56 GMT</pubDate>
    <dc:creator>Kenan</dc:creator>
    <dc:date>2021-01-22T22:11:56Z</dc:date>
    <item>
      <title>SAS Custom Sub Grouping in proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713499#M220133</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm have a hidden column in PROC report that I use to create subgroups&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hidden column&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Color&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Price&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yellow&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Red&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Green&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;22&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; black&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;44&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orange&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 123&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After Grouping (First column is hidden) the result is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Color&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Price&lt;/P&gt;&lt;P&gt;Yellow&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20&lt;/P&gt;&lt;P&gt;Red&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;50&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$70&lt;/P&gt;&lt;P&gt;Green&amp;nbsp; &amp;nbsp; &amp;nbsp; 22&lt;/P&gt;&lt;P&gt;Black&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;44&lt;/P&gt;&lt;P&gt;Orange&amp;nbsp; &amp;nbsp; 123&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;2&amp;nbsp;&lt;/FONT&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 189&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm trying to add to my proc report is the name of the subgroups: 1 and 2 shown in red above&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried but no luck so far.&lt;/P&gt;&lt;PRE&gt;	compute after Color;
	  call define('hidden column','style','style=Header{pretext="SubTotal " tagattr="Type:String"}');
	endcomp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate everyone's help!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 22:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713499#M220133</guid>
      <dc:creator>Kenan</dc:creator>
      <dc:date>2021-01-22T22:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Custom Sub Grouping in proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713503#M220136</link>
      <description>&lt;P&gt;Provide the entire Proc Report code. Order of things, such as variable names in the COLUMNS statement, is important in building Proc report. Without seeing all the code it is not really possible to correct things.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best would be to provide actual example data. "hidden column" is not acceptable as a variable name. If you have variable names with spaces or other funky characters they have to be referenced as name literals. That means there must be an n immediately after the quoted name: "hidden column"n&amp;nbsp; , the quotes could be single or double though.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 22:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713503#M220136</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-22T22:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Custom Sub Grouping in proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713506#M220137</link>
      <description>&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the real code snippet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc report data=RESULT 	
	column   ORDER COLOR AMOUNT

	define ORDER/ 'ORDER'  noprint group   order order = DATA group; 
	define COLOR/ 'COLOR'   order order = DATA group ; 
	define AMOUNT/ 'AMOUNT';

	break after ORDER/ summarize;
	compute after ORDER;
	  call define('ORDER','style','style=Header{pretext="SubTotal " tagattr="Type:String"}');
	endcomp;
	run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 22:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713506#M220137</guid>
      <dc:creator>Kenan</dc:creator>
      <dc:date>2021-01-22T22:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Custom Sub Grouping in proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713516#M220141</link>
      <description>&lt;P&gt;The first two issues are missing ; to end the Proc Report statement and the Columns statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second is that you want to modify the COLOR column, not the Order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest using a different name for you variable Order, perhaps Sequence, just so you can tell where you want to use the variable and where the Proc Report option. May not be critical but odd things do happen when you use keywords as variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How does this look:&lt;/P&gt;
&lt;PRE&gt;data result;
   input seq $   Color $    amount;
datalines;
1   Yellow 20
1   Red    50
2   Green  22
2   black  44
2   orange 123
;


proc report data=RESULT; 	
	column   seq COLOR AMOUNT  ;

	define seq / 'ORDER'  noprint group   order order = DATA group; 
	define COLOR/ 'COLOR'   order order = DATA group ; 
	define AMOUNT/ 'AMOUNT';

	break after seq/ summarize;
	compute after seq;
          call define('color','style','style=Header{color=red  tagattr="Type:String"}');
           color = catx(' ',"Group",seq);
	endcomp;
run;&lt;/PRE&gt;
&lt;P&gt;The CATX function if not familiar will insert the first character between the strings following, in this case as single space between the word Group and the value of Seq. It strips out leading and trailing spaces from the values and may make "cleaner" text in some circumstances.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 22:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713516#M220141</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-22T22:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Custom Sub Grouping in proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713529#M220146</link>
      <description>&lt;P&gt;THanks ALot. That works!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 23:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Custom-Sub-Grouping-in-proc-Report/m-p/713529#M220146</guid>
      <dc:creator>Kenan</dc:creator>
      <dc:date>2021-01-22T23:56:20Z</dc:date>
    </item>
  </channel>
</rss>

