<?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: help with finding median in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68846#M19730</link>
    <description>no actually i am writing a proc sql which i need help with. let me show you a small piece of my code.&lt;BR /&gt;
finally2 is the table name&lt;BR /&gt;
&lt;BR /&gt;
proc SQL;&lt;BR /&gt;
Create Table last&lt;BR /&gt;
	(&lt;BR /&gt;
	REGION NUM, &lt;BR /&gt;
	sum_sales DEC,&lt;BR /&gt;
          median_price DEC	);&lt;BR /&gt;
Quit;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
insert into last&lt;BR /&gt;
SELECT finally2.REGION,&lt;BR /&gt;
 SUM(finally2.sales) As Sum_sales,&lt;BR /&gt;
______ as median_price&lt;BR /&gt;
FROM finally2&lt;BR /&gt;
Group by finally2.REGION;&lt;BR /&gt;
quit;&lt;BR /&gt;
run;</description>
    <pubDate>Tue, 31 Aug 2010 20:37:20 GMT</pubDate>
    <dc:creator>saslackey</dc:creator>
    <dc:date>2010-08-31T20:37:20Z</dc:date>
    <item>
      <title>help with finding median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68844#M19728</link>
      <description>this is my table&lt;BR /&gt;
&lt;BR /&gt;
region  price  sales&lt;BR /&gt;
 1        23        45&lt;BR /&gt;
1          34       456&lt;BR /&gt;
1         233       3465&lt;BR /&gt;
1          65        34&lt;BR /&gt;
2        23         3545&lt;BR /&gt;
2          67         5653&lt;BR /&gt;
 i need to create a new table with &lt;BR /&gt;
&lt;BR /&gt;
region   median(price)  sum(sales)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
can someone tell me how to do that?</description>
      <pubDate>Tue, 31 Aug 2010 20:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68844#M19728</guid>
      <dc:creator>saslackey</dc:creator>
      <dc:date>2010-08-31T20:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: help with finding median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68845#M19729</link>
      <description>Hi:&lt;BR /&gt;
  Depending on whether you want a report or an output dataset, SAS procedures that could give you that type of information is PROC MEANS, PROC TABULATE or PROC REPORT.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 31 Aug 2010 20:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68845#M19729</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-08-31T20:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: help with finding median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68846#M19730</link>
      <description>no actually i am writing a proc sql which i need help with. let me show you a small piece of my code.&lt;BR /&gt;
finally2 is the table name&lt;BR /&gt;
&lt;BR /&gt;
proc SQL;&lt;BR /&gt;
Create Table last&lt;BR /&gt;
	(&lt;BR /&gt;
	REGION NUM, &lt;BR /&gt;
	sum_sales DEC,&lt;BR /&gt;
          median_price DEC	);&lt;BR /&gt;
Quit;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
insert into last&lt;BR /&gt;
SELECT finally2.REGION,&lt;BR /&gt;
 SUM(finally2.sales) As Sum_sales,&lt;BR /&gt;
______ as median_price&lt;BR /&gt;
FROM finally2&lt;BR /&gt;
Group by finally2.REGION;&lt;BR /&gt;
quit;&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 31 Aug 2010 20:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68846#M19730</guid>
      <dc:creator>saslackey</dc:creator>
      <dc:date>2010-08-31T20:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: help with finding median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68847#M19731</link>
      <description>It looks like a report with a summary line to me. I would be tempted to use PROC REPORT with an RBREAK statement. See related post and program example here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?threadID=11006&amp;amp;tstart=0" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=11006&amp;amp;tstart=0&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 31 Aug 2010 22:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68847#M19731</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-08-31T22:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: help with finding median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68848#M19732</link>
      <description>MS SQL  does not have a built in median function. Even if SAS was going to pass through the function somehow the data would have to come back to your computer /SAS server to be processed by SAS. &lt;BR /&gt;
&lt;BR /&gt;
Other SQL servers may, I'm not familiar with them. &lt;BR /&gt;
&lt;BR /&gt;
If you're using SAS you're much better off using a proc tabulate or proc report or Proc Means. &lt;BR /&gt;
&lt;BR /&gt;
proc sort data=sashelp.prdsale; by region; run;&lt;BR /&gt;
&lt;BR /&gt;
Proc means data=sashelp.prdsale noprint;&lt;BR /&gt;
by region;&lt;BR /&gt;
var actual;&lt;BR /&gt;
output out=last median(actual)=median_price sum(actual)=sum_sales;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 01 Sep 2010 19:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-with-finding-median/m-p/68848#M19732</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2010-09-01T19:45:53Z</dc:date>
    </item>
  </channel>
</rss>

