<?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: Computation of backward moving percentiles in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129653#M35346</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My dataset has approx. 10,000 obs., and I would like to compute 20% backward moving percentiles based on a window of 252 observations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esben &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 05:27:43 GMT</pubDate>
    <dc:creator>EsbenVibel</dc:creator>
    <dc:date>2013-07-10T05:27:43Z</dc:date>
    <item>
      <title>Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129651#M35344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I work with a time series dataset, and I need to compute a backward moving percentile for a time series. How can this be done in SAS? I have considered the EXPAND procedure, but to my knowledge this procedure can only compute a backward moving median (i.e. 50% percentile) using the "MOVMED" statement. How should I proceed if I want to compute a (for example) 20% backward moving percentile using a time window of, say, 250 observations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esben Vibel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2013 19:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129651#M35344</guid>
      <dc:creator>EsbenVibel</dc:creator>
      <dc:date>2013-07-09T19:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129652#M35345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How many obs you need to backward moving ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 01:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129652#M35345</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-10T01:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129653#M35346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My dataset has approx. 10,000 obs., and I would like to compute 20% backward moving percentiles based on a window of 252 observations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esben &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 05:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129653#M35346</guid>
      <dc:creator>EsbenVibel</dc:creator>
      <dc:date>2013-07-10T05:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129654#M35347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not familiar with proc expand, maybe you can check the documention and find some one option.&lt;/P&gt;&lt;P&gt;And my code make a window of 252 includes the current obs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have(drop=i);
do i=1 to 10000;
 x=ranuni(-1);
 output;
 end;
run;
data want;
 set have;
 array a{0:251} _temporary_ ;
 a{mod(_n_,252)}=x;
 pct_20=pctl(20,of a{*});
run;


&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;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 06:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129654#M35347</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-10T06:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129655#M35348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;When I run the last data step, the log writes the following error message:&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: The ARRAYNAME&lt;LI&gt; specification requires a variable based array&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error message refers to the last line (i.e. pct_20=pctl(20,of a{*});). Should this be changed somehow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 07:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129655#M35348</guid>
      <dc:creator>EsbenVibel</dc:creator>
      <dc:date>2013-07-10T07:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129656#M35349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have no problem. did you lost&lt;STRONG&gt; _temporary_&lt;/STRONG&gt; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 07:30:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129656#M35349</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-10T07:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129657#M35350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I simply copied your code directly into SAS and ran it. I use SAS 9.1; do I need newer version to run the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Esben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 07:35:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129657#M35350</guid>
      <dc:creator>EsbenVibel</dc:creator>
      <dc:date>2013-07-10T07:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129658#M35351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you still using sas 9.1?&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(drop=i);
do i=1 to 10000;
 x=ranuni(-1);
 output;
 end;
run;
data want(drop=aa:);
 set have;
 array a{0:251} aa1-aa252 ;
 retain aa: ;
 a{mod(_n_,252)}=x;
 pct_20=pctl(20,of a{*});
run;



&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;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 11:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129658#M35351</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2013-07-10T11:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Computation of backward moving percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129659#M35352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot! It works perfectly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 09:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Computation-of-backward-moving-percentiles/m-p/129659#M35352</guid>
      <dc:creator>EsbenVibel</dc:creator>
      <dc:date>2013-07-11T09:43:00Z</dc:date>
    </item>
  </channel>
</rss>

