<?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 Sas mixes variables after transposing in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28217#M6551</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks guys!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NickR it works great! You saved me lots of time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Jul 2011 17:58:34 GMT</pubDate>
    <dc:creator>Costasg</dc:creator>
    <dc:date>2011-07-08T17:58:34Z</dc:date>
    <item>
      <title>Sas mixes variables after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28214#M6548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am new to SAS and I am facing a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a database with three columns, Code,Date,Volume. Ihave them sorted by code and date. When I transpose the data and setting the dates as variables they get mixed. So instead of having _31DEC2001, _31JAN2002, _28FEB2002 and so on I get: _30APR2008, _31OCT2002, _31MAR2003 etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to arrange the variables(columns) so they will be in the correct date order? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching a sample file&lt;/P&gt;&lt;P&gt;I am transposing it as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=yuri out=yuri2;&lt;/P&gt;&lt;P&gt;by code;&lt;/P&gt;&lt;P&gt;id date;&lt;/P&gt;&lt;P&gt;var volume;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 15:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28214#M6548</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2011-07-08T15:56:53Z</dc:date>
    </item>
    <item>
      <title>Sas mixes variables after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28215#M6549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The variables, defined by the ID statement, are created in the same order new values of the ID variable are processed.&amp;nbsp; If the first CODE does not have all the dates then order of new vars may not be what you want/expect.&amp;nbsp; If the values of date are character they probably don't sort in data order, again not what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I sometimes create a dummy BY group that has all the ID values in the order I prefer and use that to get the desired order.&amp;nbsp; You can search for other threads that address this issue and provide examples.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 16:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28215#M6549</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-07-08T16:37:18Z</dc:date>
    </item>
    <item>
      <title>Sas mixes variables after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28216#M6550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As data_null_ said, creating dummy BY group values would help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;create table yuri_ as select distinct date,0.1 as code from yuri;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;data yuri2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set yuri yuri_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;proc sort; by code date; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;proc transpose data=yuri2 out=yuri3(where=(code^=0.1));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;by code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id date;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var volume;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 17:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28216#M6550</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2011-07-08T17:07:13Z</dc:date>
    </item>
    <item>
      <title>Sas mixes variables after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28217#M6551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many thanks guys!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NickR it works great! You saved me lots of time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2011 17:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sas-mixes-variables-after-transposing/m-p/28217#M6551</guid>
      <dc:creator>Costasg</dc:creator>
      <dc:date>2011-07-08T17:58:34Z</dc:date>
    </item>
  </channel>
</rss>

