<?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: One-sided (rolling) HP filter in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182547#M9489</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I'll look more closely at the proc ucm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Oct 2014 07:14:54 GMT</pubDate>
    <dc:creator>chris2377</dc:creator>
    <dc:date>2014-10-15T07:14:54Z</dc:date>
    <item>
      <title>One-sided (rolling) HP filter</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182545#M9487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a following problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to calculate a trend for some ratio, using one-sided Hodrick-Prescott&amp;nbsp; filter.&amp;nbsp; This means, I want to use rolling window and calculate the trend using only the data available up to the given period.&amp;nbsp; For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;format period ddmmyy10.;&lt;/P&gt;&lt;P&gt;input period ddmmyy10. ratio;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;31/03/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7035308&lt;/P&gt;&lt;P&gt;30/06/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.704633&lt;/P&gt;&lt;P&gt;30/09/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7113104&lt;/P&gt;&lt;P&gt;31/12/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7438095&lt;/P&gt;&lt;P&gt;31/03/2001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7623468&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the output dataset I would like to have another variable with the trend for the ratio, where for the first period the trend is equal to the first value of the ratio (7.7035308), for the second period it is calculated on the basis of the first and the second value of the ratio (7.7035308 and 7.704633 respectively), for the third period – on the basis of the&amp;nbsp; first, second and third value etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the next step, I would like to do the same, but separately for each country A and B, using a panel dataset. For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have1;&lt;/P&gt;&lt;P&gt;format period ddmmyy10.;&lt;/P&gt;&lt;P&gt;input period :ddmmyy10. country :$1. ratio ;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;31/03/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7035308&lt;/P&gt;&lt;P&gt;30/06/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.704633&lt;/P&gt;&lt;P&gt;30/09/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7113104&lt;/P&gt;&lt;P&gt;31/12/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.7438095&lt;/P&gt;&lt;P&gt;31/03/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.8334211&lt;/P&gt;&lt;P&gt;30/06/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.8389886&lt;/P&gt;&lt;P&gt;30/09/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.8344153&lt;/P&gt;&lt;P&gt;31/12/2000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.8422493&lt;/P&gt;&lt;P&gt;31/03/2001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.8409916&lt;/P&gt;&lt;P&gt;30/06/2001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7.8572007&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, I want to add another variable &lt;SPAN style="font-size: 13.63636302948px;"&gt;to the dataset &lt;/SPAN&gt;with rolling HP trend, but calculated separately for country A and B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas how to do this? I've looked at the proc timeseries but haven't found any option to include rolling window or set number of observations to be used to calculate the trend.&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;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Oct 2014 17:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182545#M9487</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2014-10-13T17:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: One-sided (rolling) HP filter</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182546#M9488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Chris,&lt;/P&gt;&lt;P&gt;You can use the following program (based on PROC UCM in SAS/ETS):&lt;/P&gt;&lt;P&gt;proc ucm data=have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id period interval=qtr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; model ratio;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; irregular ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; level var=0 noest print=filter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; slope var=0.000625 noest;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; estimate PROFILE;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; forecast ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;For more information see the UCM procedure documentation, particularly the example number 5(Trend Removal Using the Hodrick-Prescott Filter):&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/67525/HTML/default/viewer.htm#etsug_ucm_examples05.htm" title="http://support.sas.com/documentation/cdl/en/etsug/67525/HTML/default/viewer.htm#etsug_ucm_examples05.htm"&gt;SAS/ETS(R) 13.2 User's Guide&lt;/A&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/67525/HTML/default/viewer.htm#etsug_ucm_examples05.htm" title="http://support.sas.com/documentation/cdl/en/etsug/67525/HTML/default/viewer.htm#etsug_ucm_examples05.htm"&gt;http://support.sas.com/documentation/cdl/en/etsug/67525/HTML/default/viewer.htm#etsug_ucm_examples05.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The FORECAST variable in the output data set FOR contains the one-step-ahead forecasts of RATIO that&lt;/P&gt;&lt;P&gt;you are looking for.&amp;nbsp; Forecasts for first two quarters are missing by design because the first two observations&lt;/P&gt;&lt;P&gt;are needed for "initialization" (you can set them to some convenient values if you choose). &lt;/P&gt;&lt;P&gt;From third quarter on, the forecasts are one-sided Hodrick-Prescott filter based.&amp;nbsp; For your second example,&lt;/P&gt;&lt;P&gt;you can use the same program with COUNTRY as a BY variable (you will need to sort your data by&lt;/P&gt;&lt;P&gt;COUNTRY and PERIOD).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Rajesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 13:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182546#M9488</guid>
      <dc:creator>rselukar</dc:creator>
      <dc:date>2014-10-14T13:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: One-sided (rolling) HP filter</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182547#M9489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. I'll look more closely at the proc ucm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2014 07:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/One-sided-rolling-HP-filter/m-p/182547#M9489</guid>
      <dc:creator>chris2377</dc:creator>
      <dc:date>2014-10-15T07:14:54Z</dc:date>
    </item>
  </channel>
</rss>

