<?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: Transpose 4 columns into 2 rows in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27266#M6230</link>
    <description>Hi Jawon&lt;BR /&gt;
&lt;BR /&gt;
I don't have access to SAS right now, so please test the follwing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
data tworows(keep=Region State County City Category Qty Revenue);&lt;BR /&gt;
  set onerows(keep=Region State County City Qty_CB Qty_VB Revenue_CB Revenue_VB);&lt;BR /&gt;
  category = 'CB';&lt;BR /&gt;
  Qty = Qty_CB ;&lt;BR /&gt;
  Revenue = Revenue_CB ;&lt;BR /&gt;
  output;&lt;BR /&gt;
  category = 'VB';&lt;BR /&gt;
  Qty = Qty_VB ;&lt;BR /&gt;
  Revenue = Revenue_VB ;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;</description>
    <pubDate>Tue, 05 May 2009 12:10:50 GMT</pubDate>
    <dc:creator>GertNissen</dc:creator>
    <dc:date>2009-05-05T12:10:50Z</dc:date>
    <item>
      <title>Transpose 4 columns into 2 rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27264#M6228</link>
      <description>Of course this will be easier to explain with an example. This is what I'm starting with. The last 4 variables are numeric, representing quantity and revenue, each separated into 2 different groups...&lt;BR /&gt;
&lt;BR /&gt;
Region | State | County | City | Qty_CB | Qty_VB | Revenue_CB | Revenue_VB&lt;BR /&gt;
West | CA | LA | LA | 1 | 0 | $111 | $0&lt;BR /&gt;
Midwest | IL | Cook | Chicago | 3 | 4 | $777 | $888&lt;BR /&gt;
&lt;BR /&gt;
I want to transpose so that I end up with a new "Category" field that captures the 2 groups, and then have just one Qty field and one Revenue field...&lt;BR /&gt;
&lt;BR /&gt;
Region | State | County | City | Category | Qty | Revenue&lt;BR /&gt;
West | CA | LA | LA | CB | 1 | $111 &lt;BR /&gt;
West | CA | LA | LA | VB | 0 | $0 &lt;BR /&gt;
Midwest | IL | Cook | Chicago | CB | 3 | $777&lt;BR /&gt;
Midwest | IL | Cook | Chicago | CB | 4 | $888&lt;BR /&gt;
&lt;BR /&gt;
I think the prob I'm encountering is trying to transpose both Qty and Revenue fields, as opposed to just one. Any suggestions? Thanks much!</description>
      <pubDate>Mon, 04 May 2009 23:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27264#M6228</guid>
      <dc:creator>jawon</dc:creator>
      <dc:date>2009-05-04T23:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose 4 columns into 2 rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27265#M6229</link>
      <description>By using a data step you will have full control of your output. No problem there I believe.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Tue, 05 May 2009 06:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27265#M6229</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-05-05T06:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose 4 columns into 2 rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27266#M6230</link>
      <description>Hi Jawon&lt;BR /&gt;
&lt;BR /&gt;
I don't have access to SAS right now, so please test the follwing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
data tworows(keep=Region State County City Category Qty Revenue);&lt;BR /&gt;
  set onerows(keep=Region State County City Qty_CB Qty_VB Revenue_CB Revenue_VB);&lt;BR /&gt;
  category = 'CB';&lt;BR /&gt;
  Qty = Qty_CB ;&lt;BR /&gt;
  Revenue = Revenue_CB ;&lt;BR /&gt;
  output;&lt;BR /&gt;
  category = 'VB';&lt;BR /&gt;
  Qty = Qty_VB ;&lt;BR /&gt;
  Revenue = Revenue_VB ;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 05 May 2009 12:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27266#M6230</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2009-05-05T12:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose 4 columns into 2 rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27267#M6231</link>
      <description>Excellent. Thank you. I think I was overthinking this!</description>
      <pubDate>Wed, 06 May 2009 00:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27267#M6231</guid>
      <dc:creator>jawon</dc:creator>
      <dc:date>2009-05-06T00:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose 4 columns into 2 rows</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27268#M6232</link>
      <description>good</description>
      <pubDate>Wed, 06 May 2009 07:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Transpose-4-columns-into-2-rows/m-p/27268#M6232</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2009-05-06T07:36:41Z</dc:date>
    </item>
  </channel>
</rss>

