<?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 Sorting by variable name in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12735#M1732</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks for that! I'll try it although it'll be a bit awkward with many variable names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Feb 2012 03:18:27 GMT</pubDate>
    <dc:creator>PTD_SAS</dc:creator>
    <dc:date>2012-02-24T03:18:27Z</dc:date>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12733#M1730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way in SAS 9.3 to sort datasets alphabetically by variable names? I.e. each observation of the dataset to have the variables sorted alphabetically.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 02:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12733#M1730</guid>
      <dc:creator>PTD_SAS</dc:creator>
      <dc:date>2012-02-24T02:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12734#M1731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sure there will be better approaches, but given it is alreay 10pm est, you may not get them as timely as you wanted. So here is one option for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input b a c e d;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 2 3 4 5&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc contents data=have out=have1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select name into :name separated by ' ' from have1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;retain &amp;amp;name;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;of course, one variation of this solution is to Proc SQL for the second half part of it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;select name into :name separated by ',' from have1;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table want as select &amp;amp;name from have; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12734#M1731</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-24T03:10:05Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12735#M1732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks for that! I'll try it although it'll be a bit awkward with many variable names.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12735#M1732</guid>
      <dc:creator>PTD_SAS</dc:creator>
      <dc:date>2012-02-24T03:18:27Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12736#M1733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"Many variable names", I hope not too many and too long. As long as it 's less than 32k characters after concatenation (including blanks), you will be fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12736#M1733</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-24T03:44:26Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12737#M1734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is always the pure SQL solution:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; into :names separated by ","&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="SASHELP" and&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memname="CLASS"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by name&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; as select &amp;amp;names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from sashelp.class&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12737#M1734</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-24T03:47:10Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12738#M1735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What does that mean?&amp;nbsp; Normally when you talk of sorting a dataset you mean sorting the observations.&lt;/P&gt;&lt;P&gt;Are you saying you want to create a copy of the data with the variables ordered alphabetically by their name rather than their original position?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12738#M1735</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-24T03:48:35Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12739#M1736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom,&lt;/P&gt;&lt;P&gt;Yes, exactly. I want to have the dataset with the variables ordered alphabetically by their name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 03:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12739#M1736</guid>
      <dc:creator>PTD_SAS</dc:creator>
      <dc:date>2012-02-24T03:52:37Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12740#M1737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you try my SQL solution?&amp;nbsp; The only thing you have to insure is that, in the call to dictionary.columns, that the libname and memname are spelled in CAPs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 04:00:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12740#M1737</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-24T04:00:03Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12741#M1738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just found out that there is something worth mentioning of my solution: the case. You may want to add an option if you want to ignore the case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=have out=have1 order=ignorecase;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise it will put upper case variable names ahead of those lower case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 04:15:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12741#M1738</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-24T04:15:56Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12742#M1739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; That's excellent!, it worked. It made my job much easier because I analyse large datasets in JMP and now I can locate a specific variable name very easily.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 04:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12742#M1739</guid>
      <dc:creator>PTD_SAS</dc:creator>
      <dc:date>2012-02-24T04:35:13Z</dc:date>
    </item>
    <item>
      <title>Sorting by variable name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12743#M1740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thanks again. I used art297's SQL solution, it works very well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Feb 2012 04:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sorting-by-variable-name/m-p/12743#M1740</guid>
      <dc:creator>PTD_SAS</dc:creator>
      <dc:date>2012-02-24T04:38:25Z</dc:date>
    </item>
  </channel>
</rss>

