<?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: Code to calculate Moving Median in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213989#M52753</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have gone to that option as well, and sorry to not mention that in my first post.&lt;/P&gt;&lt;P&gt;The challenge is we don't have SAS ETS with us, thus I need a code which should work in Base SAS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 May 2015 10:07:29 GMT</pubDate>
    <dc:creator>SwapnaKumari</dc:creator>
    <dc:date>2015-05-13T10:07:29Z</dc:date>
    <item>
      <title>Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213985#M52749</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;Can anyone please help me to get SAS code to calculate moving median for last 30 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 09:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213985#M52749</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-13T09:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213986#M52750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First Google hit should help (has full code):&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/25/027.html" title="http://support.sas.com/kb/25/027.html"&gt;25027 - Compute the moving average of a variable&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 09:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213986#M52750</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-13T09:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213987#M52751</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;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The link which you shared is to calculate moving average and I have already gone through it.. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am looking for a code to calculate Moving "MEDIAN" for last 30 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 09:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213987#M52751</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-13T09:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213988#M52752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah. maybe have a look at the expand procedure then:&lt;/P&gt;&lt;P&gt;(Replace MOVAVE with the MOVMED)&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/22/104.html" style="font-size: 10pt; line-height: 1.5em;" title="http://support.sas.com/kb/22/104.html"&gt;22104 - How can I compute a moving average of a variable?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Per:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_expand_sect026.htm" title="http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_expand_sect026.htm"&gt;SAS/ETS(R) 9.2 User's Guide&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 10:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213988#M52752</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-13T10:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213989#M52753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have gone to that option as well, and sorry to not mention that in my first post.&lt;/P&gt;&lt;P&gt;The challenge is we don't have SAS ETS with us, thus I need a code which should work in Base SAS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 10:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213989#M52753</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-13T10:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213990#M52754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have SAS9.4 , then SQL can get that , otherwise use ARRAY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 13:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213990#M52754</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-13T13:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213991#M52755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I am having SAS 9.4, It would be really great if you can please share some sample code, so that I can try it at my end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 04:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213991#M52755</guid>
      <dc:creator>SwapnaKumari</dc:creator>
      <dc:date>2015-05-14T04:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213992#M52756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://gist.github.com/statgeek/27e23c015eae7953eff2" title="https://gist.github.com/statgeek/27e23c015eae7953eff2"&gt;SAS - moving min/max using arrays&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll notice the code was originally sourced from this website. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 04:56:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213992#M52756</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-14T04:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213993#M52757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. Here is an example :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
do date='01jan2014'd to today();
v=ranuni(1234);
output;
end;
format date date9.;
run;


proc sql;
create table want as 
 select *,(select median(v) from have where date between a.date-30 and a.date) as moving_median_30_day
&amp;nbsp; from have as a;
 quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 12:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213993#M52757</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-14T12:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213994#M52758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a note that the SAS SQL Median function only works in SAS 9.4&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 15:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213994#M52758</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-14T15:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Code to calculate Moving Median</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213995#M52759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza. I have already mentioned it&amp;nbsp; before .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 May 2015 12:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Code-to-calculate-Moving-Median/m-p/213995#M52759</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-15T12:44:16Z</dc:date>
    </item>
  </channel>
</rss>

