<?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: Stacking columns in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88831#M25323</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it does! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Dec 2012 20:20:50 GMT</pubDate>
    <dc:creator>sandeep249</dc:creator>
    <dc:date>2012-12-03T20:20:50Z</dc:date>
    <item>
      <title>Stacking columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88827#M25319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; background-color: #fafafa;"&gt;I know that you can stack variables Using the DATA Step, SET statement for different data sets. But how do you stack specific columns in the same data set?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; background-color: #fafafa;"&gt;I have variables x1 to x10 (with multiple observations) in a data set. And I want to stack them into two columns: (col 1: x1, x3, x5, x7, and x9 and (Col 2): x2, x4, x6, x8, and x10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; background-color: #fafafa;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please note that I am not trying to make a "wide" format dataset into a "long" format. Just trying to stack the columns one after the other ...&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-family: Verdana, Arial, Tahoma, Calibri, Geneva, sans-serif; background-color: #fafafa;"&gt;Can't seem to figure this one out.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 19:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88827#M25319</guid>
      <dc:creator>sandeep249</dc:creator>
      <dc:date>2012-12-03T19:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88828#M25320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is long to wide, just with two different sets of variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the order matter for the observations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One long way...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have (keep= x1 x2 rename=(x1=col1 x2=col2))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have (keep= x3 x4 rename=(x3=col1 x4=col2));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or...&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array one(5) x1 x3 x5 x7 x9;&lt;/P&gt;&lt;P&gt;array two(5) x2 x4 x6 x8 x10;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do i=1 to 5;&lt;/P&gt;&lt;P&gt;col1=one(i);&lt;/P&gt;&lt;P&gt;col2=two(i);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;drop i x:;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 20:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88828#M25320</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-03T20:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88829#M25321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. But I tried this method and it does not work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ARRAY method you proposed takes the first observation from x1, x3, x5, x7, x9 and puts them in col1. Then it does the same for observation 2, etc. But this not stacking the columns. The order is important, and I want col1 to have all x1 values first, then all x3 values, x5, x7, x9&lt;/P&gt;&lt;P&gt;And the same for col 2: stacked values for &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;x2 x4 x6 x8 x10&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 20:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88829#M25321</guid>
      <dc:creator>sandeep249</dc:creator>
      <dc:date>2012-12-03T20:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88830#M25322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then the first one will work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 20:13:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88830#M25322</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-12-03T20:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Stacking columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88831#M25323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it does! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 20:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Stacking-columns/m-p/88831#M25323</guid>
      <dc:creator>sandeep249</dc:creator>
      <dc:date>2012-12-03T20:20:50Z</dc:date>
    </item>
  </channel>
</rss>

