<?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: Average and median in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534142#M73865</link>
    <description>Thanks Paige Miller</description>
    <pubDate>Sat, 09 Feb 2019 16:16:29 GMT</pubDate>
    <dc:creator>abdulla</dc:creator>
    <dc:date>2019-02-09T16:16:29Z</dc:date>
    <item>
      <title>Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534094#M73853</link>
      <description>&lt;P&gt;Hi I need to find the code for average and median for the following example. Ans has to by groups and in a new column or row. Thanks in advance. Also I just need mean and median. No std and min and max.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Permno rtrn&lt;/P&gt;&lt;P&gt;0012&amp;nbsp; &amp;nbsp; &amp;nbsp;0.4&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;0012&amp;nbsp; &amp;nbsp; &amp;nbsp;0.5&lt;/P&gt;&lt;P&gt;0012&amp;nbsp; &amp;nbsp; &amp;nbsp;0.9&lt;/P&gt;&lt;P&gt;0013&amp;nbsp; &amp;nbsp; &amp;nbsp;0.8&lt;/P&gt;&lt;P&gt;0013&amp;nbsp; &amp;nbsp; &amp;nbsp;1.5&lt;/P&gt;&lt;P&gt;0013&amp;nbsp; &amp;nbsp; &amp;nbsp;0.2&lt;/P&gt;&lt;P&gt;0014&amp;nbsp; &amp;nbsp; &amp;nbsp;1.7&lt;/P&gt;&lt;P&gt;0014&amp;nbsp; &amp;nbsp; &amp;nbsp;1.8&lt;/P&gt;&lt;P&gt;0014&amp;nbsp; &amp;nbsp; &amp;nbsp;0.6&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp; proc means but it gives std and min-max which I don't want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 23:37:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534094#M73853</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-08T23:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534098#M73854</link>
      <description>&lt;P&gt;Tell PROC MEANS not to give you those statistics you don't want, and give you only the statistics you do want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have mean median;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Feb 2019 00:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534098#M73854</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-09T00:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534102#M73855</link>
      <description>I tried this solution by myself but it gives std, min and max value too. I don't want these results. I need only avg and median.&lt;BR /&gt;Can you give me an example? I am very new to SAS. So, I need help for that too.</description>
      <pubDate>Sat, 09 Feb 2019 00:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534102#M73855</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-09T00:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534104#M73856</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260675"&gt;@abdulla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I tried this solution by myself but it gives std, min and max value too. I don't want these results. I need only avg and median.&lt;BR /&gt;Can you give me an example? I am very new to SAS. So, I need help for that too.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show your code from the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data=sashelp.class mean median;
var height weight;
run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 09 Feb 2019 00:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534104#M73856</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-09T00:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534105#M73857</link>
      <description>Again I know this solution. I don't want the following which comes with mean&lt;BR /&gt;(N, std, Min and Max value)&lt;BR /&gt;Now how will I tell the proc means not to give me the above value?</description>
      <pubDate>Sat, 09 Feb 2019 00:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534105#M73857</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-09T00:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534106#M73858</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260675"&gt;@abdulla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I tried this solution by myself but it gives std, min and max value too. I don't want these results. I need only avg and median.&lt;BR /&gt;Can you give me an example? I am very new to SAS. So, I need help for that too.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Agreeing with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; , I think you are mistaken, however until we see the code you used and the results you are getting, there's no way to resolve this.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 00:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534106#M73858</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-09T00:16:29Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534107#M73859</link>
      <description>&lt;P&gt;proc means data=pred1 mean median;&lt;BR /&gt;by permno;&lt;BR /&gt;var abrtrn;&lt;BR /&gt;output out=pred2;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I am not getting any median also in my work file. I have to use noprint too. And please make sure I don't want (N, std, Min Max)--- these come with mean in my work file.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 00:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534107#M73859</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-09T00:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534108#M73860</link>
      <description>proc means data=pred1 mean median;&lt;BR /&gt;by permno;&lt;BR /&gt;var abrtrn;&lt;BR /&gt;output out=pred2;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I am not getting any median also in my work file. I have to use noprint too. And please make sure I don't want (N, std, Min Max)--- these come with mean in my work file.</description>
      <pubDate>Sat, 09 Feb 2019 00:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534108#M73860</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-09T00:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534112#M73861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260675"&gt;@abdulla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;proc means data=pred1 mean median;&lt;BR /&gt;by permno;&lt;BR /&gt;var abrtrn;&lt;BR /&gt;output out=pred2;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I am not getting any median also in my work file. I have to use noprint too. And please make sure I don't want (N, std, Min Max)--- these come with mean in my work file.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The Mean and Median on the Proc statement control output to the results window.&lt;/P&gt;
&lt;P&gt;Since you are creating an output set you have to request the statistics for the VAR variables. If no statistic is requested then you get a default set of statistics. Try:&lt;/P&gt;
&lt;PRE&gt;proc means data=pred1 mean median;
   by permno;
   var abrtrn;
   output out=pred2 mean= median= /autoname;
run;&lt;/PRE&gt;
&lt;P&gt;The autoname suffixes the variable name with the statistic to&amp;nbsp;differentiate the variables.&lt;/P&gt;
&lt;P&gt;You can request different statistics for different variables by providing the variable name with the statistic such as:&lt;/P&gt;
&lt;P&gt;mean(var1 var2)=&amp;nbsp; min (var2 var3)=.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are quite a few options with the output option and you might want to read the documentation.&lt;/P&gt;
&lt;P&gt;You may also want to investigate the different output you get using a CLASS statement instead of BY.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 00:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534112#M73861</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-02-09T00:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534114#M73862</link>
      <description>&lt;P&gt;The code worked nicely. Thanks a lot.&lt;BR /&gt;What will be code if I want to use data statement instead of proc? Also, I have some missing values in my abrtrn column. How will I exclude these missing values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use the above proc statement, where will I write "noprint"?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 00:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534114#M73862</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-09T00:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534130#M73864</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/260675"&gt;@abdulla&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What will be code if I want to use data statement instead of proc?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't do this in a data step. It's very simple in PROC MEANS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Also, I have some missing values in my abrtrn column. How will I exclude these missing values?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC MEANS handles missing values properly. No need to exclude them.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I use the above proc statement, where will I write "noprint"?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some things are easily found by looking in the documentation for PROC MEANS.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0f0fjpjeuco4gn1ri963f683mi4.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=p0f0fjpjeuco4gn1ri963f683mi4.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 12:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534130#M73864</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-09T12:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Average and median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534142#M73865</link>
      <description>Thanks Paige Miller</description>
      <pubDate>Sat, 09 Feb 2019 16:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Average-and-median/m-p/534142#M73865</guid>
      <dc:creator>abdulla</dc:creator>
      <dc:date>2019-02-09T16:16:29Z</dc:date>
    </item>
  </channel>
</rss>

