<?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: add refline and change line format in sgplot series in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838562#M23213</link>
    <description>Thanks for your suggestion. it solved my problem.&lt;BR /&gt;Sorry I wasn't being very clear about my needs. When I said 3 lines, I mean the 3 line with different types (green, blue, and red). To be more specific, I want them to be in 3 different kinds of dashed line so that when I print it out using Black&amp;amp;White printer, I'm able to distinguish which one is which.&lt;BR /&gt;Thank you!</description>
    <pubDate>Fri, 14 Oct 2022 02:50:58 GMT</pubDate>
    <dc:creator>LisaZ1</dc:creator>
    <dc:date>2022-10-14T02:50:58Z</dc:date>
    <item>
      <title>add refline and change line format in sgplot series</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838530#M23211</link>
      <description>&lt;P&gt;Hi, I'm having trouble in getting the exact series plots that I want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Particularly, I want add a refline at March 2020, but the plot only does not show Mar in 2020.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the dataset that I made up and what I did to make the plots&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data input1;
	input monthlyyear :date9. amount type;
	format monthlyyear date9.;
	datalines;
	01JAN2016 4 1
	01FEB2016 6 3
	01MAR2016 5 2
	01APR2016 39 2
	01MAY2016 49 1
	01JUN2016 34 3
	01JUL2016 49 2
	01AUG2016 30 1
	01SEP2016 30 2
	01OCT2016 2 3
	01NOV2016 34 3
	01DEC2016 30 3
	01JAN2017 56 2
	01FEB2017 45 1
	01MAR2017 45 1
	01APR2017 34 2
	01MAY2017 45 3
	01JUN2017 45 2
	01JUL2017 23 2
	01AUG2017 26 1
	01SEP2017 45 2
	01OCT2017 35 1
	01NOV2017 67 2
	01DEC2017 20 3
	01JAN2018 34 3
	01FEB2018 56 2
	01MAR2018 67 3
	01APR2018 20 2
	01MAY2018 29 3
	01JUN2018 24 2
	01JUL2018 49 2
	01AUG2018 32 1
	01SEP2018 27 1
	01OCT2018 24 2
	01NOV2018 28 3
	01DEC2018 35 2
	01JAN2019 45 3
	01FEB2019 74 2
	01MAR2019 73 1
	01APR2019 83 1 
	01MAY2019 82 3
	01JUN2019 85 2
	01JUL2019 43 3
	01AUG2019 82 2
	01SEP2019 62 1
	01OCT2019 74 3
	01NOV2019 35 3
	01DEC2019 65 3
	01JAN2020 45 2
	01FEB2020 4 2
	01MAR2020 94 2
	01APR2020 82 1
	01MAY2020 84 2
	01JUN2020 71 3
	01JUL2020 32 3
	01AUG2020 24 2
	01SEP2020 74 2
	01OCT2020 15 3
	01NOV2020 34 2
	01DEC2020 65 2
	; 
run;

proc print data=input1;
run;
proc sgplot data=input1 ;
	title "graph for input1";
	series x=monthlyyear y=amount /group=type lineattrs=(thickness=1);
	xaxis grid interval=month label="Month and Year"; 
	yaxis grid valueshint label="Expenditure";
	format MonthlyYear yymon7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is the plots that I get.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-10-13 at 7.02.28 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76168i625348B56F04C028/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2022-10-13 at 7.02.28 PM.png" alt="Screen Shot 2022-10-13 at 7.02.28 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to add refline at Apr 2016, Jun 2017, Oct 2018, Aug 2019, and Mar 2020. Since Aug and Mar are not shown in the axis, I don't know how to add refline. I'm also wonder if I'm able to add short description on those reflines.&lt;/P&gt;&lt;P&gt;In addition, I also want to make the three lines as different dashed so that when I print it out black and white, I'm able to distinguish which line is which.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions is appreciated!!&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 23:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838530#M23211</guid>
      <dc:creator>LisaZ1</dc:creator>
      <dc:date>2022-10-13T23:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: add refline and change line format in sgplot series</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838541#M23212</link>
      <description>&lt;P&gt;First thing, that is &lt;STRONG&gt;5 reflines&lt;/STRONG&gt; not 3.&lt;/P&gt;
&lt;P&gt;Here's how to do 2 with different appearance. You should be able to add the rest following the pattern.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;
proc sgplot data=input1 ;
	title "graph for input1";
	series x=monthlyyear y=amount /group=type lineattrs=(thickness=1);
	xaxis grid interval=month label="Month and Year"; 
	yaxis grid valueshint label="Expenditure";
	format MonthlyYear yymon7.;
   refline '01Apr2016'd  /axis=x label='Label for Apr 2016' lineattrs=(pattern=10 color=blue thickness= .5mm);
   refline '01MAR2020'd  /axis=x label='Label for Mar 2020' lineattrs=(pattern=1 color=red thickness=1mm);
run;&lt;/PRE&gt;
&lt;P&gt;There are additional options in REFLINE documentation to control the text of the label and to position the label.&lt;/P&gt;
&lt;P&gt;The LINEATTRS documentation will link to specific examples and the Pattern definitions that control the line appearance. There are about a dozen named line patterns like Solid dot dash dotdashdot shortdash or 46 numbers with 1 being a solid line.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 00:51:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838541#M23212</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-14T00:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: add refline and change line format in sgplot series</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838562#M23213</link>
      <description>Thanks for your suggestion. it solved my problem.&lt;BR /&gt;Sorry I wasn't being very clear about my needs. When I said 3 lines, I mean the 3 line with different types (green, blue, and red). To be more specific, I want them to be in 3 different kinds of dashed line so that when I print it out using Black&amp;amp;White printer, I'm able to distinguish which one is which.&lt;BR /&gt;Thank you!</description>
      <pubDate>Fri, 14 Oct 2022 02:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838562#M23213</guid>
      <dc:creator>LisaZ1</dc:creator>
      <dc:date>2022-10-14T02:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: add refline and change line format in sgplot series</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838570#M23214</link>
      <description>&lt;P&gt;You may also want to look at &lt;STRIKE&gt;BANDS&lt;/STRIKE&gt;&amp;nbsp;BLOCKS to have shaded bands in the graph instead. I find it's easier chart to read if the background colour changes instead of reflines. &lt;BR /&gt;&lt;BR /&gt;See the Results tab here: &lt;A href="https://support.sas.com/kb/42/893.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/42/893.html (GPLOT)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;SGPLOT solution with BLOCK&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Graphics-Programming/sgplot-shading-background-of-a-plot/td-p/825632" target="_blank"&gt;https://communities.sas.com/t5/Graphics-Programming/sgplot-shading-background-of-a-plot/td-p/825632&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 04:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838570#M23214</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-14T04:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: add refline and change line format in sgplot series</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838640#M23215</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/418934"&gt;@LisaZ1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks for your suggestion. it solved my problem.&lt;BR /&gt;Sorry I wasn't being very clear about my needs. When I said 3 lines, I mean the 3 line with different types (green, blue, and red). To be more specific, I want them to be in 3 different kinds of dashed line so that when I print it out using Black&amp;amp;White printer, I'm able to distinguish which one is which.&lt;BR /&gt;Thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It may be a good idea to mark the message that solves your problem. That way someone else searching the forum or getting here from a search engine can tell the question was solved.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 14:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/add-refline-and-change-line-format-in-sgplot-series/m-p/838640#M23215</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-14T14:49:18Z</dc:date>
    </item>
  </channel>
</rss>

