<?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: Anyway to plot one single line with diffrent colors and thickness, for different ranges?! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994332#M380521</link>
    <description>&lt;P&gt;Please provide a DATA step to generate the data, and code to generate the basic plot (SGPLOT?).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would think you could add a GROUP variable to your data, with 3 levels, and use that as a /group option on your plot statement.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2026 13:16:49 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2026-09-29T13:16:49Z</dc:date>
    <item>
      <title>Anyway to plot one single line with diffrent colors and thickness, for different ranges?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994322#M380517</link>
      <description>&lt;P&gt;Say here is one single line y=sin(x). need to plot&lt;/P&gt;
&lt;P&gt;[0,2*pi] with color=red and thickness=1.5&lt;/P&gt;
&lt;P&gt;[2*pi,5*pi] with color=lime and thickness=2.0&lt;/P&gt;
&lt;P&gt;OW color=green and thickness=1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to do it?!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2026 10:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994322#M380517</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2026-09-29T10:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Anyway to plot one single line with diffrent colors and thickness, for different ranges?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994332#M380521</link>
      <description>&lt;P&gt;Please provide a DATA step to generate the data, and code to generate the basic plot (SGPLOT?).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would think you could add a GROUP variable to your data, with 3 levels, and use that as a /group option on your plot statement.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2026 13:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994332#M380521</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2026-09-29T13:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Anyway to plot one single line with diffrent colors and thickness, for different ranges?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994347#M380522</link>
      <description>&lt;P&gt;Which interval does 2*pi actually belong? The way you have stated the first two intervals with closed end it is defined as belonging to both intervals. One of the intervals needs to be open.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/409584"&gt;@hellohere&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Say here is one single line y=sin(x). need to plot&lt;/P&gt;
&lt;P&gt;[0,2*pi&lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;]&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="4"&gt; w&lt;/FONT&gt;&lt;/FONT&gt;ith color=red and thickness=1.5&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#FF0000"&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/FONT&gt;2*pi,5*pi] with color=lime and thickness=2.0&lt;/P&gt;
&lt;P&gt;OW color=green and thickness=1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to do it?!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And what attributes for x less than 0? Is that included in the OW, which I have to&amp;nbsp;&lt;STRONG&gt;guess&lt;/STRONG&gt; means "otherwise"?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2026 17:49:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994347#M380522</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-09-29T17:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Anyway to plot one single line with diffrent colors and thickness, for different ranges?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994351#M380523</link>
      <description>&lt;P&gt;My basic approach would be to add a GROUP variable for the range of values and a DATTRMAP data set since that is the easiest way to set multiple plot options .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on your current ODS style the thickness numbers you specified may not have much visible difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my approach:&lt;/P&gt;
&lt;PRE&gt;data toplot;
do x= 0 to (6*constant('PI')) by 0.01;
   y=sin(x);
   if 0 le x lt (2*constant('PI')) then band=1;
   else if (2*constant('PI')) le x le (5*constant('PI')) then band=2; 
   else band=3;
   output;
end;
run;

data sinattrplot;
   input id $ value $   linecolor $ linethickness;
datalines;
sin_base  1  red    1.5
sin_base  2  lime   2.0
sin_base  3  green  1.0
;


proc sgplot data=toplot dattrmap=sinattrplot;
  series x=x y=y / attrid=sin_base group=band;
run;&lt;/PRE&gt;
&lt;P&gt;Note that the names of variables in the attribute map data sets are set for the actual attributes involved and change between discrete, DATTRMAP data set, and ranged attributes, RATTRMAP data set.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2026 18:07:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Anyway-to-plot-one-single-line-with-diffrent-colors-and/m-p/994351#M380523</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-09-29T18:07:31Z</dc:date>
    </item>
  </channel>
</rss>

