<?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: How to extrapolate or forecast values based on a fitted curve of existing values in SAS Forecasting and Econometrics</title>
    <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477836#M3218</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input year y@@;
datalines;
2008    .
2009    .
2010    0.3624
2011    0.3971
2012    0.4366
2013    0.4804
2014    0.5291
2015    0.5859
;

ods output sgplot=temp;
proc sgplot data=test;
reg x=year y=y/cli clm degree=2;
run;

proc print noobs;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Jul 2018 11:51:24 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-07-13T11:51:24Z</dc:date>
    <item>
      <title>How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477303#M3214</link>
      <description>&lt;P&gt;I'd like to extrapolate missing values based on a fitted curve of existing data points, using version 9.4.&amp;nbsp; Here's my data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Year&lt;/U&gt;&amp;nbsp; &amp;nbsp; &lt;U&gt;NPs_per_pop&lt;/U&gt;&lt;BR /&gt;2008&amp;nbsp; &amp;nbsp; .&lt;BR /&gt;2009&amp;nbsp; &amp;nbsp; .&lt;BR /&gt;2010&amp;nbsp; &amp;nbsp; 0.3624&lt;BR /&gt;2011&amp;nbsp; &amp;nbsp; 0.3971&lt;BR /&gt;2012&amp;nbsp; &amp;nbsp; 0.4366&lt;BR /&gt;2013&amp;nbsp; &amp;nbsp; 0.4804&lt;BR /&gt;2014&amp;nbsp; &amp;nbsp; 0.5291&lt;BR /&gt;2015&amp;nbsp; &amp;nbsp; 0.5859&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Graphing the data looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21732i0DC5694BC1E93117/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to estimate 2008 and 2009 based on a fitted curve of the existing 2010-2015 values.&amp;nbsp; Since I couldn't figure out how to "forecast" into the past, I first reversed the order of the data set, so that the first observation is from 2015 and the last is from 2008:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Order&lt;/U&gt;&amp;nbsp; &amp;nbsp; &lt;U&gt;NPs_per_pop&lt;/U&gt;&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.5859&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.5291&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.4804&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.4366&lt;BR /&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.3971&lt;BR /&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.3624&lt;BR /&gt;7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;BR /&gt;8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The closest I've been able to come is estimating based on the straight line of best fit, using proc esm:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc esm data=original out=estimated lead=2;
	forecast NPs_per_pop / model=linear;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which produces this (when the order is reversed again, so it goes from 2008-2015):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21733i10BFAF11A3814B46/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The linear model is an ok fit, but not great..... one reason is that the values should always be positive, fitting more of an exponential model.&amp;nbsp; I tried the different options of proc esm (e.g., transform=logistic), but nothing seemed to populate 2008 and 2009 with a fitted curve.&amp;nbsp; Any help on how to do that would be appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 02:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477303#M3214</guid>
      <dc:creator>ANevola</dc:creator>
      <dc:date>2018-07-12T02:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477452#M3215</link>
      <description>&lt;P&gt;You could try PROC LOESS&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc reg data=have;&lt;/P&gt;
&lt;P&gt;model y= x x^2 ;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;wrote a blog about it before .&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 13:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477452#M3215</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-07-12T13:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477572#M3216</link>
      <description>&lt;P&gt;Thanks for you response.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc reg gave me an error under the exponent operator (**), saying "&lt;FONT color="#FF0000"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /,:, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_, {&lt;/FONT&gt;."&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc reg data=reg;
	model NPs_per_pop = year year**2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried the syntax of proc loess in one of the examples given, but it wouldn't produce a smoothed plot of my variables:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on;
proc loess data=reg;
ods output OutputStatistics = Fit
                 FitSummary=Summary;
model NPs_per_pop = year / degree=2 select=AICC(steps) smooth = 0.6 1.0
                      direct alpha=.01;
run;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Either way, though, neither procedure seems to produce an extrapolation of missing data points.&amp;nbsp; Could you give a little more detail on how you were thinking those procedures would fill in missing values based on a fitted curve?&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 15:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477572#M3216</guid>
      <dc:creator>ANevola</dc:creator>
      <dc:date>2018-07-12T15:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477673#M3217</link>
      <description>&lt;P&gt;Like PROC ESM, PROC SSM is also part of SAS/ETS.&amp;nbsp; You could use it for model based back-propagation, interpolation and forecasting.&amp;nbsp; It is a bit more involved than ESM.&amp;nbsp; Anyway, here is one possibility:&lt;/P&gt;
&lt;P&gt;data test;&lt;BR /&gt;input year y@@;&lt;BR /&gt;year = mdy(1,1, year);&lt;BR /&gt;format year date.;&lt;BR /&gt;datalines;&lt;BR /&gt;2008&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;BR /&gt;2009&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;BR /&gt;2010&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.3624&lt;BR /&gt;2011&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.3971&lt;BR /&gt;2012&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.4366&lt;BR /&gt;2013&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.4804&lt;BR /&gt;2014&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5291&lt;BR /&gt;2015&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5859&lt;BR /&gt;;&lt;BR /&gt;proc ssm data=test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; id year interval=year;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; trend curve(ps(2));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; irregular wn;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; model y = curve wn;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output out=for press;&lt;BR /&gt;run;&lt;BR /&gt;proc sgplot data=for;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; scatter x=year y=y;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; series x=year y=smoothed_curve;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; reg x=year y=y;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;See the attached fit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 12 Jul 2018 19:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477673#M3217</guid>
      <dc:creator>rselukar</dc:creator>
      <dc:date>2018-07-12T19:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477836#M3218</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input year y@@;
datalines;
2008    .
2009    .
2010    0.3624
2011    0.3971
2012    0.4366
2013    0.4804
2014    0.5291
2015    0.5859
;

ods output sgplot=temp;
proc sgplot data=test;
reg x=year y=y/cli clm degree=2;
run;

proc print noobs;run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jul 2018 11:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477836#M3218</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-07-13T11:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477910#M3220</link>
      <description>&lt;P&gt;Thanks for your response.&amp;nbsp; It looks like my computer doesn't have sufficient memory for proc ssm, though.&amp;nbsp; I got the following error message:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;8485  proc ssm data=reg;
8486     id year interval=year;
8487     trend curve(ps(2));
8488     irregular wn;
8489     model NPs_per_pop = curve wn;
8490     output out=for press;
8491  run;

ERROR: Insufficient memory for data reading.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'll try to find a computer with more memory to run the code you suggested. Thanks again.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477910#M3220</guid>
      <dc:creator>ANevola</dc:creator>
      <dc:date>2018-07-13T15:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477914#M3221</link>
      <description>&lt;P&gt;That is very strange.&amp;nbsp; SSM should not have memory issues for such a small sized problem even on a basic computer.&amp;nbsp; Anyway, keep me posted.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:34:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477914#M3221</guid>
      <dc:creator>rselukar</dc:creator>
      <dc:date>2018-07-13T15:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to extrapolate or forecast values based on a fitted curve of existing values</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477934#M3222</link>
      <description>&lt;P&gt;The SSM procedure handles a variety of models and it's syntax and output might take some getting used to.&amp;nbsp; You can see Example 3 ("&lt;SPAN&gt;Backcasting, Forecasting, and Interpolation"&lt;/SPAN&gt;) in the SSM doc for an additional example.&amp;nbsp; If you just want the back-casted values in your case, you can use the following modification of the code (print=smooth option in the MODEL statement):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc ssm data=test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; id year interval=year;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; trend curve(ps(2));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; irregular wn;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; model y = curve wn / print=smooth;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; output out=for press;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 15:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/How-to-extrapolate-or-forecast-values-based-on-a-fitted-curve-of/m-p/477934#M3222</guid>
      <dc:creator>rselukar</dc:creator>
      <dc:date>2018-07-13T15:52:38Z</dc:date>
    </item>
  </channel>
</rss>

