<?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: Consistent Colors on a Graph when replicating it several times in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/275032#M9826</link>
    <description>&lt;P&gt;Thanks! &amp;nbsp;This was actually quite helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2016 17:00:39 GMT</pubDate>
    <dc:creator>einstein</dc:creator>
    <dc:date>2016-06-03T17:00:39Z</dc:date>
    <item>
      <title>Consistent Colors on a Graph when replicating it several times</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273695#M9777</link>
      <description>&lt;P&gt;Using Proc GPLOT I have a line graph showing number of prescriptions by drug type over several years. &amp;nbsp;Each graph is recreated for each state. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I can't seem to get the colors to remain consistent for each drug when I replicate the graph for each state.&lt;/P&gt;&lt;P&gt;Is there anyway to indicate if the drug='Ibuprofen' then the line color should be green, etc. &amp;nbsp;I can't seem to find an option to do that.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the code I used:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%_eg_conditional_dropds(WORK.SORTTempTableSorted);
SYMBOL1
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_

;
SYMBOL2
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_
;
SYMBOL3
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2
CV = _STYLE_
;

Legend1
FRAME
;
Axis1
STYLE=1
WIDTH=1
MINOR=NONE

;
Axis2
STYLE=1
WIDTH=1
MINOR=NONE
;

PROC SQL;
CREATE VIEW WORK.SORTTempTableSorted AS
SELECT statecd, hcv_rc ,Year_qtr ,
SUM(num_presc) AS num_presc_SUM 
FROM HCV.HCVX
GROUP BY statecd, hcv_rc,Year_qtr
ORDER BY statecd, hcv_rc,Year_qtr;
QUIT;

PROC GPLOT DATA = WORK.SORTTempTableSorted;
PLOT num_presc_SUM * Year_qtr =hcv_rc
/
VAXIS=AXIS1
HAXIS=AXIS2
FRAME SKIPMISS
LEGEND=LEGEND1
;
by statecd;
RUN; QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 19:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273695#M9777</guid>
      <dc:creator>einstein</dc:creator>
      <dc:date>2016-05-27T19:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent Colors on a Graph when replicating it several times</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273698#M9778</link>
      <description>&lt;P&gt;The best way to do this is to use PROC SGPLOT with an attributes map. &amp;nbsp;If you look at pages 8-9 of my paper (see the link below), you will see an example this. For your case, your code will look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data attrmap;
retain id "myid";
length linestyleelement $ 10 markerstyleelement $ 10;
input value $ linestyleelement $ markerstyleelement $;
cards;
drug1 GraphData1&amp;nbsp;GraphData1
drug2&amp;nbsp;GraphData2&amp;nbsp;GraphData2
drug3 GraphData3&amp;nbsp;GraphData3
;
run;

proc sgplot data=work.SORTEDTempTableSorted dattrmap=attrmap;
   series x=year_qtr y=num_presc_sum / group=hcv_rc attrid=myid;
run;



&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0ahUKEwim6tzK__rMAhWHFCwKHUwKD1MQFggcMAA&amp;amp;url=https%3A%2F%2Fsupport.sas.com%2Fresources%2Fpapers%2Fproceedings14%2FSAS156-2014.pdf&amp;amp;usg=AFQjCNGTFP57ikdQCjLjIIFOpOhYPR6Uhw&amp;amp;bvm=bv.122676328,d.bGg" target="_blank"&gt;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;uact=8&amp;amp;ved=0ahUKEwim6tzK__rMAhWHFCwKHUwKD1MQFggcMAA&amp;amp;url=https%3A%2F%2Fsupport.sas.com%2Fresources%2Fpapers%2Fproceedings14%2FSAS156-2014.pdf&amp;amp;usg=AFQjCNGTFP57ikdQCjLjIIFOpOhYPR6Uhw&amp;amp;bvm=bv.122676328,d.bGg&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 19:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273698#M9778</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-05-27T19:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent Colors on a Graph when replicating it several times</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273716#M9779</link>
      <description>&lt;P&gt;Some times it helps to make sure that all values&amp;nbsp;of your grouping variables such as hvc_rc appear within others (your statecd) even if the Y value is missing.&lt;/P&gt;
&lt;P&gt;The attributes is preferred but if you stick with GPLOT or have an older version of SAS such as 9.2 then the added value will help, especially when sorted.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 20:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273716#M9779</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-27T20:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent Colors on a Graph when replicating it several times</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273736#M9780</link>
      <description>&lt;P&gt;Here ar two more resources with examples:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2012/10/17/specify-the-colors-of-groups-in-sas-statistical-graphics.html" target="_self"&gt;Specify the colors of groups in SAS statistical graphics&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/02/17/include-and-order-categories-in-legends.html" target="_self"&gt;A simple trick to include (and order!) all categories in SGPLOT legends&lt;/A&gt;&lt;/P&gt;
&lt;DIV id="wrapper" class="hfeed"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="wrapper" class="hfeed"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 27 May 2016 23:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/273736#M9780</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-05-27T23:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent Colors on a Graph when replicating it several times</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/275032#M9826</link>
      <description>&lt;P&gt;Thanks! &amp;nbsp;This was actually quite helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2016 17:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/275032#M9826</guid>
      <dc:creator>einstein</dc:creator>
      <dc:date>2016-06-03T17:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Consistent Colors on a Graph when replicating it several times</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/275033#M9827</link>
      <description>Thanks Rick! This was also super helpful!</description>
      <pubDate>Fri, 03 Jun 2016 17:01:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Consistent-Colors-on-a-Graph-when-replicating-it-several-times/m-p/275033#M9827</guid>
      <dc:creator>einstein</dc:creator>
      <dc:date>2016-06-03T17:01:00Z</dc:date>
    </item>
  </channel>
</rss>

