<?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: PROC SGPLOT traffic lighting in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/743030#M232538</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;! Your solution seems like creating static precalculated ranges in the previous data step. I tried to calculate the color responses I want in a previous data step (please see the example below) yet I'm not getting exactly what I need (though I fully acknowledge that I did not replicate your data step in your proposed solution). Note the if/then statement in the second data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I was hoping that, based on the if/then statement, QC and AB in panel "1&amp;amp;2"&amp;nbsp; would be colored green (because cupper&amp;lt;obsmean) and QC in panel "3" would be colored red (because clower&amp;gt;obsmean).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;input level $ obsmean site $ cpred clower cupper;&lt;BR /&gt;datalines;&lt;BR /&gt;1&amp;amp;2 11.2716763 AB 11.2091 10.2363 12.2633&lt;BR /&gt;3 9.648187633 AB 6.7446 5.4658 8.2922&lt;BR /&gt;1&amp;amp;2 11.2716763 BC 10.953 10.0474 11.9304&lt;BR /&gt;3 9.648187633 BC 8.4634 7.2455 9.86&lt;BR /&gt;1&amp;amp;2 11.2716763 NB 12.8006 10.4527 15.6237&lt;BR /&gt;1&amp;amp;2 11.2716763 ON 12.2879 10.6616 14.1237&lt;BR /&gt;1&amp;amp;2 11.2716763 QC 9.1078 8.3792 9.8939&lt;BR /&gt;3 9.648187633 QC 13.7365 12.3518 15.2589&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data test2;&lt;BR /&gt;length color $5.;&lt;BR /&gt;set test1;&lt;/P&gt;&lt;P&gt;if clower&amp;gt;obsmean then color='red';&lt;BR /&gt;if cupper&amp;lt;obsmean then color='green';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sgpanel data=test2;&lt;BR /&gt;panelby level/columns=2 novarname sort=data onepanel;&lt;BR /&gt;rowaxis values=(0 to 15 by 5) offsetmin=.05 offsetmax=.05 grid label=" ";&lt;BR /&gt;colaxis offsetmin=.2 offsetmax=.2 grid label=" ";&lt;BR /&gt;scatter x=site y=cpred/yerrorupper=cupper&lt;BR /&gt;yerrorlower=clower&lt;BR /&gt;MARKERATTRS=(symbol=squarefilled color=black size=10)&lt;BR /&gt;TRANSPARENCY=0.3&lt;BR /&gt;DATALABEL=cpred&lt;BR /&gt;DATALABELPOS=right&lt;BR /&gt;DATALABELATTRS=(color=black weight=bold size=5)&lt;BR /&gt;colorresponse=cpred;&lt;BR /&gt;refline obsmean;&lt;BR /&gt;format cpred 4.1;&lt;BR /&gt;title ' ';&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Fri, 21 May 2021 19:29:55 GMT</pubDate>
    <dc:creator>Recep</dc:creator>
    <dc:date>2021-05-21T19:29:55Z</dc:date>
    <item>
      <title>PROC SGPLOT traffic lighting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/742967#M232512</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I was wondering if there is any capacity within PROC SGPLOT for traffic lighting (i.e. for instance certain points in a SCATTER plot will be colored red if they fall within a certain range otherwise they will be green, etc.)? I searched this online and could not find out anything solid. I know that PROC REPORT has traffic lighting options but I prefer to stick to PROC SGPLOT as it may take some time for me to figure out how to produce figures with PROC REPORT if that's even possible.&lt;/P&gt;&lt;P&gt;If you can direct me to a source if traffic lighting is possible within PROC SGPLOT, I would really appreciate it.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;Recep&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 16:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/742967#M232512</guid>
      <dc:creator>Recep</dc:creator>
      <dc:date>2021-05-21T16:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT traffic lighting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/742995#M232528</link>
      <description>&lt;P&gt;Look at RATTRMAP&lt;/P&gt;
&lt;P&gt;Example from the documentation that uses a data set SASHELP.CLASS to plot that you should have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data myrattrmap;
retain id "myID";
length min $ 5 max $ 5;
input min $ max $ color $ altcolor $;
datalines;
_min_ 80    purple purple
80    100   gold   gold
100   _max_ green  green
;
run;

proc sgplot data=sashelp.class rattrmap=myrattrmap;
  scatter x=height y=weight / 
    colorresponse=weight rattrid=myID;
run;
&lt;/PRE&gt;
&lt;P&gt;The variable names have to match the expected properties of&amp;nbsp; an RATTRMAP data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 17:58:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/742995#M232528</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-21T17:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT traffic lighting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/743030#M232538</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;! Your solution seems like creating static precalculated ranges in the previous data step. I tried to calculate the color responses I want in a previous data step (please see the example below) yet I'm not getting exactly what I need (though I fully acknowledge that I did not replicate your data step in your proposed solution). Note the if/then statement in the second data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I was hoping that, based on the if/then statement, QC and AB in panel "1&amp;amp;2"&amp;nbsp; would be colored green (because cupper&amp;lt;obsmean) and QC in panel "3" would be colored red (because clower&amp;gt;obsmean).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;input level $ obsmean site $ cpred clower cupper;&lt;BR /&gt;datalines;&lt;BR /&gt;1&amp;amp;2 11.2716763 AB 11.2091 10.2363 12.2633&lt;BR /&gt;3 9.648187633 AB 6.7446 5.4658 8.2922&lt;BR /&gt;1&amp;amp;2 11.2716763 BC 10.953 10.0474 11.9304&lt;BR /&gt;3 9.648187633 BC 8.4634 7.2455 9.86&lt;BR /&gt;1&amp;amp;2 11.2716763 NB 12.8006 10.4527 15.6237&lt;BR /&gt;1&amp;amp;2 11.2716763 ON 12.2879 10.6616 14.1237&lt;BR /&gt;1&amp;amp;2 11.2716763 QC 9.1078 8.3792 9.8939&lt;BR /&gt;3 9.648187633 QC 13.7365 12.3518 15.2589&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data test2;&lt;BR /&gt;length color $5.;&lt;BR /&gt;set test1;&lt;/P&gt;&lt;P&gt;if clower&amp;gt;obsmean then color='red';&lt;BR /&gt;if cupper&amp;lt;obsmean then color='green';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sgpanel data=test2;&lt;BR /&gt;panelby level/columns=2 novarname sort=data onepanel;&lt;BR /&gt;rowaxis values=(0 to 15 by 5) offsetmin=.05 offsetmax=.05 grid label=" ";&lt;BR /&gt;colaxis offsetmin=.2 offsetmax=.2 grid label=" ";&lt;BR /&gt;scatter x=site y=cpred/yerrorupper=cupper&lt;BR /&gt;yerrorlower=clower&lt;BR /&gt;MARKERATTRS=(symbol=squarefilled color=black size=10)&lt;BR /&gt;TRANSPARENCY=0.3&lt;BR /&gt;DATALABEL=cpred&lt;BR /&gt;DATALABELPOS=right&lt;BR /&gt;DATALABELATTRS=(color=black weight=bold size=5)&lt;BR /&gt;colorresponse=cpred;&lt;BR /&gt;refline obsmean;&lt;BR /&gt;format cpred 4.1;&lt;BR /&gt;title ' ';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 21 May 2021 19:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/743030#M232538</guid>
      <dc:creator>Recep</dc:creator>
      <dc:date>2021-05-21T19:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT traffic lighting</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/743042#M232544</link>
      <description>&lt;P&gt;If you want to use an "if/then" assignment then you make that variable a group variable in a scatter plot.&lt;/P&gt;
&lt;P&gt;Then you use either a styleattrs statement to override the color assignments or create a Dattrmap data set to set colors, markers, size, line types based on the values of the group variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see what a default style difference would make try this:&lt;/P&gt;
&lt;PRE&gt;proc sgpanel data=test2;
panelby level/columns=2 novarname sort=data onepanel;
rowaxis values=(0 to 15 by 5) offsetmin=.05 offsetmax=.05 grid label=" ";
colaxis offsetmin=.2 offsetmax=.2 grid label=" ";
scatter x=site y=cpred/yerrorupper=cupper
yerrorlower=clower group=color /*&amp;lt;= this tells SAS to use levels of the variable color to change attributes*/
MARKERATTRS=( size=10)
TRANSPARENCY=0.3
DATALABEL=cpred
DATALABELPOS=right
DATALABELATTRS=(color=black weight=bold size=5)
colorresponse=cpred;
refline obsmean;
format cpred 4.1;
title ' ';
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 May 2021 20:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-traffic-lighting/m-p/743042#M232544</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-21T20:20:25Z</dc:date>
    </item>
  </channel>
</rss>

