<?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: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777638#M15560</link>
    <description>Thank you so much!</description>
    <pubDate>Mon, 01 Nov 2021 05:03:49 GMT</pubDate>
    <dc:creator>keherder</dc:creator>
    <dc:date>2021-11-01T05:03:49Z</dc:date>
    <item>
      <title>Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777459#M15554</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;0&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN style="font-family: inherit;"&gt;I have a scatter plot of calls / time. My x variable is supposed to be the date (Day/Month) and my Y variable is a number of calls on each date. I would like to plot two regression lines using PROC SGPLOT REG, one for 2019 and one for 2020. However, I cannot figure out a way to make my dates correspond to 1-365, which I need in order to do this.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I used a date value in SAS and changed the format to mm/dd, but this doesn't help because the regression lines are just on either end of the graph rather than overlapping (picture attached)&lt;SPAN&gt;&amp;nbsp;(I realize t&lt;/SPAN&gt;his is because SAS dates correspond to numbers from 1/1/1960). What I want is the mm/dd to correspond to numbers 1-365 so I get two overlapping regression lines to show how the trends changed from one year to the next. Anyone know how I can do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot1.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65251i8A2EEB699676D26D/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot1.png" alt="SGPlot1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 30 Oct 2021 04:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777459#M15554</guid>
      <dc:creator>keherder</dc:creator>
      <dc:date>2021-10-30T04:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777460#M15555</link>
      <description>&lt;P&gt;data new;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set old;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;days1 = date1 + 1 - '01May2019'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;days2 = date2 + 1 - '01May2021'd;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then plot days1 and days2. Adjust the variables and dates as necessary.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Oct 2021 05:51:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777460#M15555</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2021-10-30T05:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777611#M15556</link>
      <description>&lt;P&gt;I have had several similar projects. The approach as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt; has done is to standardize all the dates to a common year and then on the X axis use a format that does not display year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another method to standardize would be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;date = mdy(month(date),day(date),&amp;lt;year&amp;gt;);&lt;/P&gt;
&lt;P&gt;where Year would be the year picked as a standard date. Suggest a leap year so you don't get odd artifacts when one of your data years is leap year.&lt;/P&gt;
&lt;P&gt;With a known standard year you could still use Xaxis values such as Values=('01MAYYYYY'd to '01JAN&amp;lt;year+1'd by month).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date5. format will display ddMON, no year.&lt;/P&gt;</description>
      <pubDate>Sun, 31 Oct 2021 22:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777611#M15556</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-31T22:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777618#M15557</link>
      <description>This is what we do as well. Just a note that we don't standardize based on day, ie January 1 to January 1 is not what we do because our business has weekly spikes and weekend dips so we align the first Mondays in the year and then go from there. This is quite common when aligning your time series and helps to account for seasonality a bit more in the graph. It depends on your usage and data though so go what you need. &lt;BR /&gt;&lt;BR /&gt;You can convert a date to a day of year using the following calculation, regardless of year.  &lt;BR /&gt;&lt;BR /&gt;DayOfYear = date - intnx('year', date, 0, 'b') + 1;&lt;BR /&gt;year = year(date);&lt;BR /&gt;&lt;BR /&gt;SGPLOT&lt;BR /&gt;&lt;BR /&gt;series x=dayofYear y = value / group = year;&lt;BR /&gt;</description>
      <pubDate>Sun, 31 Oct 2021 23:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777618#M15557</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-31T23:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777619#M15558</link>
      <description>Are you doing this in SAS VA though? If so, that's a different story than doing it via code. You're posting these questions in VA which is a BI tool, not a programming tool?</description>
      <pubDate>Sun, 31 Oct 2021 23:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777619#M15558</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-31T23:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777637#M15559</link>
      <description>This was exactly what I needed, thank you so much! I removed the +1 however, because with that all my dates were a day off. I accidently posted this in VA by mistake, I am just using SAS 9.4.</description>
      <pubDate>Mon, 01 Nov 2021 05:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777637#M15559</guid>
      <dc:creator>keherder</dc:creator>
      <dc:date>2021-11-01T05:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Plot Two Regression Lines on Same Scatter Plot By Year: X-Axis Date MM/DD</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777638#M15560</link>
      <description>Thank you so much!</description>
      <pubDate>Mon, 01 Nov 2021 05:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Plot-Two-Regression-Lines-on-Same-Scatter-Plot-By-Year-X-Axis/m-p/777638#M15560</guid>
      <dc:creator>keherder</dc:creator>
      <dc:date>2021-11-01T05:03:49Z</dc:date>
    </item>
  </channel>
</rss>

