<?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: How do I sort means by descending order after PROC MEANS in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719167#M9739</link>
    <description>&lt;P&gt;A few comments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not a statistician, so I don't know how statisticians think, but in the business world you almost never want to run MEANS or SUMMARY (or REPORT or TABULATE) without the MISSING keyword, because you almost never want to just throw away data.&amp;nbsp; You want your totals to add up to the same numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a matter of preference, but I almost never use PROC MEANS.&amp;nbsp; If I want "printed" output, I create a data set with PROC SUMMARY and then print it using PROC PRINT or TABULATE or REPORT.&amp;nbsp; Those procedures are more flexible and produce better looking output.&amp;nbsp; In general, REPORT and TABULATE are really useful to know, because they can produce complex output without a lot of programming on your part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, none of your code contains what SAS calls a "function". PROC MEANS is a procedure, not a function.&amp;nbsp; MEAN is the name of a function, and also of a statistic/keyword.&amp;nbsp; Your code uses MEAN as a keyword, not as a function.&amp;nbsp; Even in a PROC SUMMARY statement like OUTPUT OUT=XYZ MEAN(abc)=ABC_MEAN , the word MEAN is a keyword, even though it looks like a function.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Feb 2021 23:39:55 GMT</pubDate>
    <dc:creator>JackHamilton</dc:creator>
    <dc:date>2021-02-13T23:39:55Z</dc:date>
    <item>
      <title>How do I sort means by descending order after PROC MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719150#M9735</link>
      <description>&lt;P&gt;Hello, I have been trying to sort my means after computing them with the PROC MEANS function. I used the same code for the a slightly different problem. When I use the proc sort function, it tell me my variable does does exist. Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-02-13 at 4.38.25 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54706iE535CF70B66C606C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-02-13 at 4.38.25 PM.png" alt="Screenshot 2021-02-13 at 4.38.25 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 21:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719150#M9735</guid>
      <dc:creator>mroungou</dc:creator>
      <dc:date>2021-02-13T21:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort means by descending order after PROC MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719160#M9736</link>
      <description>&lt;P&gt;Run a PROC CONTENTS to see what variables are actually in the data set you want to sort.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 22:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719160#M9736</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2021-02-13T22:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort means by descending order after PROC MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719165#M9737</link>
      <description>&lt;P&gt;I am curious why you decided to use the ODS OUTPUT statement instead of the more traditional OUTPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the program below and make sure you understand the differences and similarities in the print output and data sets.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/**********/
title 'proc means ods_output_stackodsoutput';
ods output summary=ods_output_stackodsoutput;
proc means data=sashelp.class mean sum std stackodsoutput;
    var age height;
run;

title 'means output ods_output_stackodsoutput';
proc print data=ods_output_stackodsoutput; run;


/**********/
title 'proc means ods_output_nostackodsoutput';
ods output summary=ods_output_nostackodsoutput;
proc means data=sashelp.class mean sum std ;
    var age height;
run;

title 'means output ods_output_nostackodsoutput';
proc print data=ods_output_nostackodsoutput; run;


/**********/
title 'proc means means_output_stackodsoutput';
proc means data=sashelp.class mean sum std stackodsoutput;
    var age height;
    output out=means_output_stackodsoutput;
run;

title 'means output means_output_stackodsoutput';
proc print data=means_output_stackodsoutput; run;


/**********/
title 'proc means means_output_nostackodsoutput';
proc means data=sashelp.class mean sum std ;
    var age height;
    output out=means_output_nostackodsoutput;
run;

title 'means output means_output_nostackodsoutput';
proc print data=means_output_nostackodsoutput; run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I moved the ODS OUTPUT statements outside the PROC MEANS statements because the ODS OUTPUT statement is not part of PROC MEANS procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 22:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719165#M9737</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2021-02-13T22:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort means by descending order after PROC MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719166#M9738</link>
      <description>To be honest, I'm new to SAS and my professor gave us a challenging assignment to do so I am somewhat figuring out how to use the different functions and when. I'll take a look at the code you provided and do some research to better understand. Thanks for the help!</description>
      <pubDate>Sat, 13 Feb 2021 23:13:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719166#M9738</guid>
      <dc:creator>mroungou</dc:creator>
      <dc:date>2021-02-13T23:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I sort means by descending order after PROC MEANS</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719167#M9739</link>
      <description>&lt;P&gt;A few comments:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not a statistician, so I don't know how statisticians think, but in the business world you almost never want to run MEANS or SUMMARY (or REPORT or TABULATE) without the MISSING keyword, because you almost never want to just throw away data.&amp;nbsp; You want your totals to add up to the same numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a matter of preference, but I almost never use PROC MEANS.&amp;nbsp; If I want "printed" output, I create a data set with PROC SUMMARY and then print it using PROC PRINT or TABULATE or REPORT.&amp;nbsp; Those procedures are more flexible and produce better looking output.&amp;nbsp; In general, REPORT and TABULATE are really useful to know, because they can produce complex output without a lot of programming on your part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, none of your code contains what SAS calls a "function". PROC MEANS is a procedure, not a function.&amp;nbsp; MEAN is the name of a function, and also of a statistic/keyword.&amp;nbsp; Your code uses MEAN as a keyword, not as a function.&amp;nbsp; Even in a PROC SUMMARY statement like OUTPUT OUT=XYZ MEAN(abc)=ABC_MEAN , the word MEAN is a keyword, even though it looks like a function.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 23:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-sort-means-by-descending-order-after-PROC-MEANS/m-p/719167#M9739</guid>
      <dc:creator>JackHamilton</dc:creator>
      <dc:date>2021-02-13T23:39:55Z</dc:date>
    </item>
  </channel>
</rss>

