<?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 do I have forecast and actual times series on a same graph in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/730065#M21247</link>
    <description>&lt;P&gt;See the article &lt;A href="https://blogs.sas.com/content/iml/2016/11/21/forecast-regions.html" target="_self"&gt;"Highlight forecast regions in graphs"&lt;/A&gt;, which shows how to get the plot by using PROC ARIMA and to get a similar plot by using PROC SGPLOT.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 12:31:53 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2021-03-30T12:31:53Z</dc:date>
    <item>
      <title>How do I have forecast and actual times series on a same graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729719#M21241</link>
      <description>&lt;P&gt;Hi, I've just done estimating and forecasting using ARIMA, below is my code. I want to do the Hold-out method where I have my test set and my training set separated, then compare the test set with what I forecasted, I want to have both of them on the same graph now. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods html close;
ods html;

data tesla;
infile "/folders/myfolders/TSLA (1).csv" delimiter=',' firstobs=2;
input date :anydtdte. open high low close adj_close vol;
format date MONYY7.;
informat date MONYY7.;
proc print data=tesla;

ods graphics on;
proc sgplot data=tesla;
series x=date y=open;
Xaxis values=('01Jun2010'd to '01Jun2019'd by year) valuesformat=year4.;
title 'TSLA Opening Price';
run;

proc arima data=tesla;
identify var=open(1);
estimate p=3 q=2 method=ml noconstant; 
forecast lead=12 out=teslaforecast; 
proc print data=teslaforecast;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 08:20:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729719#M21241</guid>
      <dc:creator>thuphammm</dc:creator>
      <dc:date>2021-03-29T08:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I have forecast and actual times series on a same graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729822#M21242</link>
      <description>&lt;P&gt;To display multiple sorts of values on the same graph the data must be in a single data set. General rule regardless of data sources or type of graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the idea is to combine the "forecast" and "actual" data in a manner that has a variable that indicates the source of the data.&lt;/P&gt;
&lt;P&gt;You would want to have the same x and y variable names. One way to combine that adds a source variable with the name of the contributing data set.&lt;/P&gt;
&lt;PRE&gt;data combine;
   set dataset1 
        dataset2
        indsname=ds
   ;
   source=ds;
run;
&lt;/PRE&gt;
&lt;P&gt;Other approaches could use the "in=invar" data set option and set a desired source value based on the In variables.&lt;/P&gt;
&lt;P&gt;Then something like:&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=combined;
   series x=xvar y=yvar / group=sourcevar;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 15:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729822#M21242</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-29T15:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I have forecast and actual times series on a same graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729851#M21243</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just add this to your PROC ARIMA statement&lt;/P&gt;
&lt;P&gt;plots=FORECAST(ALL).&lt;/P&gt;
&lt;DIV class="xis-refProc"&gt;
&lt;DIV id="etsug.arima.ariprocstmt" class="AAsection"&gt;
&lt;DIV class="AAoptions"&gt;
&lt;DL class="AAoptions"&gt;
&lt;DD&gt;
&lt;P&gt;This PLOTS option in the PROC ARIMA statement controls the plots produced through ODS Graphics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice day,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DD&gt;
&lt;/DL&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 29 Mar 2021 17:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729851#M21243</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-03-29T17:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I have forecast and actual times series on a same graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729924#M21245</link>
      <description>&lt;P&gt;Thank you for your help, I think it worked a little bit, I just don't know how to draw a graph from the combined data set.. This is what I put in:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data combine;
   set tesla 
        teslaforecast
        indsname=ds
   ;
   source=ds;
proc print data=combine;
proc sgplot data=combine;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and this is the outcome:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-03-30 at 09.29.42.png" style="width: 360px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56646i89EA11DF2B3D263D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-03-30 at 09.29.42.png" alt="Screen Shot 2021-03-30 at 09.29.42.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I couldn't get the graph to appear &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 02:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/729924#M21245</guid>
      <dc:creator>thuphammm</dc:creator>
      <dc:date>2021-03-30T02:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I have forecast and actual times series on a same graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/730053#M21246</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's better to include the log if you want debugging by other community members.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your SGPLOT code is a bit brief. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; No&amp;nbsp;wonder you don't get a plot back.&lt;/P&gt;
&lt;P&gt;You should at least tell the procedure what it has to plot (with a series statement for example).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 10:55:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/730053#M21246</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-03-30T10:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I have forecast and actual times series on a same graph</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/730065#M21247</link>
      <description>&lt;P&gt;See the article &lt;A href="https://blogs.sas.com/content/iml/2016/11/21/forecast-regions.html" target="_self"&gt;"Highlight forecast regions in graphs"&lt;/A&gt;, which shows how to get the plot by using PROC ARIMA and to get a similar plot by using PROC SGPLOT.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 12:31:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-have-forecast-and-actual-times-series-on-a-same-graph/m-p/730065#M21247</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-03-30T12:31:53Z</dc:date>
    </item>
  </channel>
</rss>

