<?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 How to get the variable list in the descending order of their mean values？ in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110375#M30641</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For example, I have one dataset:mydata. How to get the variable list in which var1-var4 are sorted by the descending order of their mean values?&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mydata;&lt;/P&gt;&lt;P&gt;input var1 var2 var3 var4;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;1 3 1 6&lt;/P&gt;&lt;P&gt;4 5 8 9&lt;/P&gt;&lt;P&gt;2 8 2 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 May 2012 16:03:21 GMT</pubDate>
    <dc:creator>TomiKong</dc:creator>
    <dc:date>2012-05-10T16:03:21Z</dc:date>
    <item>
      <title>How to get the variable list in the descending order of their mean values？</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110375#M30641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For example, I have one dataset:mydata. How to get the variable list in which var1-var4 are sorted by the descending order of their mean values?&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mydata;&lt;/P&gt;&lt;P&gt;input var1 var2 var3 var4;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;1 3 1 6&lt;/P&gt;&lt;P&gt;4 5 8 9&lt;/P&gt;&lt;P&gt;2 8 2 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 16:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110375#M30641</guid>
      <dc:creator>TomiKong</dc:creator>
      <dc:date>2012-05-10T16:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the variable list in the descending order of their mean values？</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110376#M30642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mydata;&lt;/P&gt;&lt;P&gt;input var1 var2 var3 var4;&lt;/P&gt;&lt;P&gt;xx=mean(of var1-var4);&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;1 3 1 6&lt;/P&gt;&lt;P&gt;4 5 8 9&lt;/P&gt;&lt;P&gt;2 8 2 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=mydata;by descending xx;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 16:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110376#M30642</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-05-10T16:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the variable list in the descending order of their mean values？</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110377#M30643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Depend upon what you actually want.&amp;nbsp; E.g., it might require something like the following if you actually want the dataset variables to be reordered:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data mydata;&lt;/P&gt;&lt;P&gt;input var1 var2 var3 var4;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 2 3 4&lt;/P&gt;&lt;P&gt;1 3 1 6&lt;/P&gt;&lt;P&gt;4 5 8 9&lt;/P&gt;&lt;P&gt;2 8 2 2&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc means data=mydata noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=var_means(drop=_FREQ_ _TYPE_);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc transpose data=var_means out=trans_mean(rename=(_NAME_=NAME));&lt;/P&gt;&lt;P&gt;&amp;nbsp; id _STAT_;&lt;/P&gt;&lt;P&gt;run;&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 into :names&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; separated by " "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from trans_mean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by mean desc&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&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;&amp;nbsp; retain &amp;amp;names.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set mydata;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 16:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-get-the-variable-list-in-the-descending-order-of-their/m-p/110377#M30643</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-05-10T16:32:12Z</dc:date>
    </item>
  </channel>
</rss>

