<?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: Proc Means Var Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241228#M44691</link>
    <description>&lt;P&gt;You can always output the data set and then run a sort procedure after the means procedure.&amp;nbsp; It's in two steps instead of one, but will still get you what you are wanting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data means data=have noprint;
var _numeric_;
output out=want
mean=Mean;
run;

proc sort data=want;
by descending Mean;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Dec 2015 16:00:01 GMT</pubDate>
    <dc:creator>dcruik</dc:creator>
    <dc:date>2015-12-30T16:00:01Z</dc:date>
    <item>
      <title>Proc Means Var Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241220#M44686</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a data set with 100s of&amp;nbsp;numeric variables that are similar in nature. To create a simple list report about their averages&amp;nbsp;I have used Proc Means:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var _numeric_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS documentation for the Var Statement reads:&amp;nbsp; "Identifies the analysis variables and their order in the output."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using "_numeric_" in the Var Statement to avoid listing 100s of variables, is there any way to control their order in the output?&amp;nbsp; In this situation, the ideal list report would show the variables in descending order of the Mean.&amp;nbsp; I'm sure there's a proc means output&amp;nbsp;--&amp;gt; data step&amp;nbsp;with array&amp;nbsp;--&amp;gt; proc sort&amp;nbsp;--&amp;gt; proc print&amp;nbsp;solution for this, but I wanted to see if Proc Means has the capability.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:27:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241220#M44686</guid>
      <dc:creator>bzh</dc:creator>
      <dc:date>2015-12-30T14:27:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means Var Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241228#M44691</link>
      <description>&lt;P&gt;You can always output the data set and then run a sort procedure after the means procedure.&amp;nbsp; It's in two steps instead of one, but will still get you what you are wanting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data means data=have noprint;
var _numeric_;
output out=want
mean=Mean;
run;

proc sort data=want;
by descending Mean;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Dec 2015 16:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241228#M44691</guid>
      <dc:creator>dcruik</dc:creator>
      <dc:date>2015-12-30T16:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means Var Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241243#M44694</link>
      <description>&lt;P&gt;PROC MEANS doesn't have the capability.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even in theory, building that capability would involve major work. &amp;nbsp;Remember, PROC MEANS can use both a BY statement and a CLASS statement. &amp;nbsp;Should the order change from one value of a BY variable to the next? &amp;nbsp;It becomes a very sticky problem, very quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 17:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241243#M44694</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-12-30T17:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means Var Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241251#M44695</link>
      <description>Use proc means with the stackods option to get the data in a long format by default. Then you can sort directly without arrays or any other intermediate steps.</description>
      <pubDate>Wed, 30 Dec 2015 17:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241251#M44695</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-30T17:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Means Var Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241259#M44696</link>
      <description>&lt;P&gt;Thanks Everyone!&amp;nbsp; I chose Astounding's response as the answer as it confirms that Proc Means cannot sort variables if "_numeric_" is in the Var Statement.&lt;/P&gt;&lt;P&gt;However, Reeza's reply is the best solution for the report I need to build.&amp;nbsp; Here is a SAS 9.4 link that goes with Reeza's stackods suggestion:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/proc/68954/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf947dundi.htm" target="_self"&gt;https://support.sas.com/documentation/cdl/en/proc/68954/HTML/default/viewer.htm#p17h6q7ygvkl1sn13qzf947dundi.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Dec 2015 18:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Means-Var-Statement/m-p/241259#M44696</guid>
      <dc:creator>bzh</dc:creator>
      <dc:date>2015-12-30T18:32:12Z</dc:date>
    </item>
  </channel>
</rss>

