<?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 Report - &amp;quot;Transposing and Collapsing a Column&amp;quot; in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245833#M15145</link>
    <description>&lt;P&gt;I made another group variable N to make it happen.&lt;/P&gt;
&lt;P&gt;You will see N is how to generate in data step.&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2016 09:45:03 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-01-25T09:45:03Z</dc:date>
    <item>
      <title>Proc Report - "Transposing and Collapsing a Column"</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245482#M15136</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data teams;
input
team $5. wins group $5.;
format
team $5.;
datalines;
TeamA 10 West
TeamA 15 West
TeamA 32 West
TeamB 2  West
TeamB 17 West
TeamB 5  West
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using proc report to transpose the team names and grouping them by group. I am using the following code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report nowd data=teams
style(header)=[background=white];
col (group (('Teams' team),(wins)));
	define group/   "Group";
	define team /  across style (header)=[background=lightblue] ' ' ; 
	define wins /  "Wins";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the code I get the following result below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to figure out what I am missing here, I want&amp;nbsp;to group both teams by group, so that the end result would look like below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;West&lt;/TD&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edited:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to figure it out later and wanted to keep to post for others if further reference is needed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding group in the line solves the problem&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report nowd data=teams
style(header)=[background=white];
col (group division (('Teams' team),(wins)));
	define group/&lt;FONT color="#FF0000"&gt; group&lt;/FONT&gt;  "Group";
	define division/ group  "Div";
	define team /  across style (header)=[background=lightblue] ' ' ; 
	define wins /  "Wins";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jan 2016 20:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245482#M15136</guid>
      <dc:creator>krm</dc:creator>
      <dc:date>2016-01-22T20:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - "Transposing and Collapsing a Column"</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245793#M15142</link>
      <description>&lt;P&gt;You need to change data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data teams;
input team $5. wins group $5.;
format
team $5.;
datalines;
TeamA 10 West
TeamA 15 West
TeamA 32 West
TeamB 2  West
TeamB 17 West
TeamB 5  West
;
run;
data teams;
 set teams;
 by group team;
 if first.team then n=0;
 n+1;
run;
proc report nowd data=teams
style(header)=[background=white];
col group n ('Teams' team),wins;
	define group/group   "Group";
	define n/group noprint;
	define team /  across style (header)=[background=lightblue] ' ' ; 
	define wins /  "Wins";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jan 2016 02:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245793#M15142</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-25T02:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - "Transposing and Collapsing a Column"</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245828#M15144</link>
      <description>&lt;P&gt;Could you please tell me the purpose of folloing line in proc report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;col group n ('Teams' team),wins;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jan 2016 09:19:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245828#M15144</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2016-01-25T09:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report - "Transposing and Collapsing a Column"</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245833#M15145</link>
      <description>&lt;P&gt;I made another group variable N to make it happen.&lt;/P&gt;
&lt;P&gt;You will see N is how to generate in data step.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 09:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-quot-Transposing-and-Collapsing-a-Column-quot/m-p/245833#M15145</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-25T09:45:03Z</dc:date>
    </item>
  </channel>
</rss>

