<?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: Grouping Transpose Columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/820695#M323967</link>
    <description>&lt;P&gt;the solution is in Tom's reply,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Transpose-column-with-chronological-order/m-p/817722#M322761" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Transpose-column-with-chronological-order/m-p/817722#M322761&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jun 2022 14:18:38 GMT</pubDate>
    <dc:creator>sarahzhou</dc:creator>
    <dc:date>2022-06-28T14:18:38Z</dc:date>
    <item>
      <title>Grouping Transpose Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817735#M322764</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an input table:&lt;/P&gt;
&lt;TABLE width="257"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="56"&gt;TEAM_1&lt;/TD&gt;
&lt;TD width="56"&gt;TEAM_2&lt;/TD&gt;
&lt;TD width="75"&gt;EVENT_NM&lt;/TD&gt;
&lt;TD width="70"&gt;EVENT_DT&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;ALICE&lt;/TD&gt;
&lt;TD&gt;JIMMY&lt;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lt;/TD&gt;
&lt;TD&gt;09-01-22&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AMBER&lt;/TD&gt;
&lt;TD&gt;DANIEL&lt;/TD&gt;
&lt;TD&gt;E&lt;/TD&gt;
&lt;TD&gt;10-01-22&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;KITTY&lt;/TD&gt;
&lt;TD&gt;ARRON&lt;/TD&gt;
&lt;TD&gt;F&lt;/TD&gt;
&lt;TD&gt;11-01-22&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the output like this:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 432pt;" border="0" width="576" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.4pt; width: 48pt;"&gt;TEAM_1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;TEAM_2&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;Orange&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;Berry&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;C&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;D&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;E&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;F&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;ALICE&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;JIMMY&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;01-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;02-01-22&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;03-01-22&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;04-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;05-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;3&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;06-01-22&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;07-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;ELLA&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;JACK&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;08-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;09-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;AMBER&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;DANIEL&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;10-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;KITTY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;ARRON&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD align="right" class="xl66" style="border-top: none; border-left: none;"&gt;11-01-22&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previouly Tom has help this, maybe he is too busy to see my new problem. Thx Tom.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input TEAM_1 $ TEAM_2 $ EVENT_NM $ EVENT_DT :mmddyy. ;
  format event_dt yymmdd10.;
cards;
ALICE  JIMMY  Orange  1-1-2022
CINDY  BOB  Orange  1-2-2022
CINDY  BOB  Berry  1-3-2022
CINDY  BOB  C  1-4-2022
CINDY  BOB  Berry  1-5-2022
CINDY  BOB  Berry  1-6-2022
CINDY  BOB  C  1-7-2022
ELLA  JACK  Berry  1-8-2022
ELLA  JACK  D  1-9-2022
AMBER  DANIEL  E  1-10-2022
KITTY  ARRON  F  1-11-2022
;

data groups;
  set have;
  by team_1 team_2 notsorted ;
  group + (event_nm &amp;lt;= lag(event_nm) );
  if first.team_2 then group=1;
run;
proc transpose data=groups out=wide(drop=_name_);
  by team_1 team_2 group notsorted;
  id event_nm;
  var event_dt;
run;
proc print data=wide;
run;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;The code gives an wrong out put:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sarahzhou_0-1655114720464.png" style="width: 648px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72180i6478D18ED329941B/image-dimensions/648x230?v=v2" width="648" height="230" role="button" title="sarahzhou_0-1655114720464.png" alt="sarahzhou_0-1655114720464.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;group + (event_nm &amp;lt;= lag(event_nm) )&lt;/CODE&gt;&amp;nbsp;this tric does not work anymore.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appriciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 10:07:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817735#M322764</guid>
      <dc:creator>sarahzhou</dc:creator>
      <dc:date>2022-06-13T10:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping Transpose Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817755#M322782</link>
      <description>&lt;P&gt;how are the groups supposed to be assigned?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 11:21:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817755#M322782</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2022-06-13T11:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping Transpose Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817805#M322807</link>
      <description>&lt;P&gt;I've changed EVENT_TX back by using case and followed by Tom's method. It worked.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 14:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817805#M322807</guid>
      <dc:creator>sarahzhou</dc:creator>
      <dc:date>2022-06-13T14:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping Transpose Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817946#M322846</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/402346"&gt;@sarahzhou&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I've changed EVENT_TX back by using case and followed by Tom's method. It worked.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then mark your statement, with a reference link to Tom's method, as the solution.&amp;nbsp; Then readers know a solution has been found.&amp;nbsp; And your topic will be more helpful to others.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 19:35:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/817946#M322846</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2022-06-13T19:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping Transpose Columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/820695#M323967</link>
      <description>&lt;P&gt;the solution is in Tom's reply,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Transpose-column-with-chronological-order/m-p/817722#M322761" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Transpose-column-with-chronological-order/m-p/817722#M322761&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 14:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Grouping-Transpose-Columns/m-p/820695#M323967</guid>
      <dc:creator>sarahzhou</dc:creator>
      <dc:date>2022-06-28T14:18:38Z</dc:date>
    </item>
  </channel>
</rss>

