<?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: Refer To Column One Variable Without Knowing Variable Name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415922#M102095</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A couple of steps before proc sort may produce the desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc contents data=sashelp.cars order=varnum out=vars(keep=name varnum) ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select name into :sort_var from vars&lt;BR /&gt;where varnum=1;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;proc sort data=cars;&lt;BR /&gt;by &amp;amp;sort_var;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Nov 2017 03:26:08 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2017-11-24T03:26:08Z</dc:date>
    <item>
      <title>Refer To Column One Variable Without Knowing Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415909#M102091</link>
      <description>&lt;P&gt;I would like to sort a dataset, by the first column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;&lt;BR /&gt;by Col#1;&lt;BR /&gt;run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Suppose I don't have the actual name of the Col#1 variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(Actually, I do, of course, but it varies among datasets.&amp;nbsp; And I'm seeking a generic approach.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can this be done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nicholas Kormanik&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 01:29:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415909#M102091</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2017-11-24T01:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Refer To Column One Variable Without Knowing Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415910#M102092</link>
      <description>&lt;P&gt;Not via PROC SORT but PROC SQL allows it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 02:13:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415910#M102092</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-24T02:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Refer To Column One Variable Without Knowing Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415922#M102095</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A couple of steps before proc sort may produce the desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc contents data=sashelp.cars order=varnum out=vars(keep=name varnum) ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select name into :sort_var from vars&lt;BR /&gt;where varnum=1;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;proc sort data=cars;&lt;BR /&gt;by &amp;amp;sort_var;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 03:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415922#M102095</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2017-11-24T03:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Refer To Column One Variable Without Knowing Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415932#M102098</link>
      <description>&lt;P&gt;Use SQL, as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;suggested, or sort by everything (it will sort on the first&amp;nbsp;variable first)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql; 
create table cars as select * from sashelp.cars 
order by 1; 
quit;

/* Or */

proc sort data=sashelp.cars out=cars; by _all_; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 04:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415932#M102098</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-11-24T04:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Refer To Column One Variable Without Knowing Variable Name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415946#M102106</link>
      <description>&lt;P&gt;Thank you all for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since these datasets only contain two columns, it is easiest to sort by everything.&amp;nbsp; Straightforward and easy.&amp;nbsp; Wonderful.&amp;nbsp; Glad it can be done this way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 08:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Refer-To-Column-One-Variable-Without-Knowing-Variable-Name/m-p/415946#M102106</guid>
      <dc:creator>NKormanik</dc:creator>
      <dc:date>2017-11-24T08:35:16Z</dc:date>
    </item>
  </channel>
</rss>

