<?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: Distinct markers attribute (color) when labeling only certain observations in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870153#M23690</link>
    <description>&lt;P&gt;It sounds like you want a group variable for when an observation is marked or not marked. Without data I can't test the code, but try starting with the following and modify it if it isn't exactly correct:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
set noemers_acute_ZH_YR2;
Group1 = (LabelVar1 = "" );
Group2 = (LabelVar2 = "" );
run;

/* UNTESTED */
proc sgplot data=noemers_acute_ZH_YR2;
series x=YEAR y=PatientDays / group=Group1 datalabel=LabelVar1 datalabelpos=bottomright markers markerattrs=(symbol=circlefilled ) lineattrs=(color="#3AAA35" thickness=2) /*legendlabel="Standard Lab Value"*/;
series x=YEAR y=Admissions / group=Group2 datalabel=LabelVar2 datalabelpos=bottomleft markers markerattrs=(symbol=squarefilled) lineattrs=(color="#B4CF00" thickness=2) Y2Axis/* legendlabel="New Device"*/;
xaxis label="Year" &amp;amp;styleaxis ;
yaxis label="Patient Days" grid values=(0 to 13000000) ;
y2axis label="Admissions" grid values=(0 to 18000000 ) ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 17 Apr 2023 12:58:36 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2023-04-17T12:58:36Z</dc:date>
    <item>
      <title>Distinct markers attribute (color) when labeling only certain observations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870130#M23687</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I&amp;nbsp;&lt;SPAN&gt;give a distrinct color to only markers where labels selection is displayed ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data noemers_acute_ZH_YR2;&lt;BR /&gt;set noemers_acute_ZH_YR;&lt;BR /&gt;LabelVar1 = put(PatientDays,$NLNUM10.);&lt;BR /&gt;LabelVar2 = put(Admissions,$NLNUM10.);&lt;BR /&gt;if Year not in ("&amp;amp;start_year.", "2019", "2020", "&amp;amp;last_year.") then do;&lt;BR /&gt;LabelVar1 = "" ;&lt;BR /&gt;LabelVar2 = "" ;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sgplot data=noemers_acute_ZH_YR2;&lt;BR /&gt;series x=YEAR y=PatientDays / datalabel=LabelVar1 datalabelpos=bottomright markers markerattrs=(color="#3AAA35" symbol=circlefilled ) lineattrs=(color="#3AAA35" thickness=2) /*legendlabel="Standard Lab Value"*/;&lt;BR /&gt;series x=YEAR y=Admissions / datalabel=LabelVar2 datalabelpos=bottomleft markers markerattrs=(color="#B4CF00" symbol=squarefilled) lineattrs=(color="#B4CF00" thickness=2) Y2Axis/* legendlabel="New Device"*/;&lt;BR /&gt;xaxis label="Year" &amp;amp;styleaxis ;&lt;BR /&gt;yaxis label="Patient Days" grid values=(0 to 13000000) ;&lt;BR /&gt;y2axis label="Admissions" grid values=(0 to 18000000 ) ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Many thanks&lt;BR /&gt;Laura&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 11:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870130#M23687</guid>
      <dc:creator>LauraBona92</dc:creator>
      <dc:date>2023-04-17T11:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct markers attribute (color) when labeling only certain observations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870134#M23688</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/369457"&gt;@LauraBona92&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I&amp;nbsp;&lt;SPAN&gt;give a distrinct color to only markers where labels selection is displayed ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please explain this further. What does "... where labels selection is displayed" mean? If possible, show a fake graph to illustrate what you mean.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 11:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870134#M23688</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-17T11:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct markers attribute (color) when labeling only certain observations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870153#M23690</link>
      <description>&lt;P&gt;It sounds like you want a group variable for when an observation is marked or not marked. Without data I can't test the code, but try starting with the following and modify it if it isn't exactly correct:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Want;
set noemers_acute_ZH_YR2;
Group1 = (LabelVar1 = "" );
Group2 = (LabelVar2 = "" );
run;

/* UNTESTED */
proc sgplot data=noemers_acute_ZH_YR2;
series x=YEAR y=PatientDays / group=Group1 datalabel=LabelVar1 datalabelpos=bottomright markers markerattrs=(symbol=circlefilled ) lineattrs=(color="#3AAA35" thickness=2) /*legendlabel="Standard Lab Value"*/;
series x=YEAR y=Admissions / group=Group2 datalabel=LabelVar2 datalabelpos=bottomleft markers markerattrs=(symbol=squarefilled) lineattrs=(color="#B4CF00" thickness=2) Y2Axis/* legendlabel="New Device"*/;
xaxis label="Year" &amp;amp;styleaxis ;
yaxis label="Patient Days" grid values=(0 to 13000000) ;
y2axis label="Admissions" grid values=(0 to 18000000 ) ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Apr 2023 12:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870153#M23690</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-04-17T12:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct markers attribute (color) when labeling only certain observations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870156#M23691</link>
      <description>&lt;P&gt;find hereby the plot generated by my previous code.&lt;/P&gt;&lt;P&gt;I would like grey color markers when label displayed (cfr data step labelvar1 labelvar2 &amp;gt;&amp;gt; when year in (2012, 2019, 2020, 2021)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 13:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870156#M23691</guid>
      <dc:creator>LauraBona92</dc:creator>
      <dc:date>2023-04-17T13:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct markers attribute (color) when labeling only certain observations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870184#M23694</link>
      <description>&lt;P&gt;For this display, you will need to control the marker color at a group level using the GROUPMC option. To use this option, you will need to create a fake group variable, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;was showing. Then, you will need a variable to track which observations are labeled. This will be the variable you use on the GROUPMC option. Also, I used a small attributes map to control the color to use for those observations. See the example below to see the general idea. Let me know if you need further explanation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set sashelp.class (obs=7);
if (name="Alice") then do;
dlab=name;
labeled=1;
end;
else do;
dlab="";
labeled=0;
end;
group=1;
run;

data attrmap;
ID="myid";
value="1";
markercolor="gray";
run;

proc sgplot data=class noautolegend dattrmap=attrmap;
series x=age  y=weight / group=group markers mcattrid=myid
                         groupmc=labeled datalabel=dlab;
series x=age  y=height / group=group markers mcattrid=myid
                         groupmc=labeled datalabel=dlab;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Apr 2023 14:58:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870184#M23694</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2023-04-17T14:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Distinct markers attribute (color) when labeling only certain observations</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870255#M23695</link>
      <description>&lt;P&gt;I would create additional 'y' variables in the dataset, and only assign them values for the markers you want to label. And then layer those on top of the lines, with the desired colors (such as gray markers, and the text matching the line color). I think this makes it a little simpler. Here's some sample code, using sample data from sashelp...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data noemers_acute_ZH_YR2;
set sashelp.stocks (where=(stock='IBM' and date&amp;gt;='01jan1997'd and date&amp;lt;='31jan1999'd));
if put(date,monname3.) in ('Jan') then do;
 close_with_label=close;
 LabelVar1 = put(close,$NLNUM10.);
 volume_with_label=volume;
 LabelVar2 = put(volume,$NLNUM10.);
 end;
run;

proc sgplot data=noemers_acute_ZH_YR2 noautolegend;
format date year4.;
series x=date y=close / markers markerattrs=(color="#3AAA35" symbol=circlefilled ) lineattrs=(color="#3AAA35" thickness=2);
series x=date y=volume / markers markerattrs=(color="#B4CF00" symbol=squarefilled) lineattrs=(color="#B4CF00" thickness=2) Y2Axis;
series x=date y=close_with_label / markers markerattrs=(color="gray" symbol=circlefilled ) lineattrs=(thickness=0) 
  datalabel=LabelVar1 datalabelpos=bottom datalabelattrs=(color="#3AAA35");
series x=date y=volume_with_label / markers markerattrs=(color="gray" symbol=squarefilled) lineattrs=(thickness=0) Y2Axis
  datalabel=LabelVar2 datalabelpos=top datalabelattrs=(color="#B4CF00");
xaxis label="Date" /*values=('01jan1995'd to '01jan2000'd by year5)*/;
yaxis label="Close" grid values=(50 to 200 by 50);
y2axis label="Volume" grid values=(5000000 to 20000000 by 5000000 );
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sample_plot.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82779i93B068079805FC65/image-size/large?v=v2&amp;amp;px=999" role="button" title="sample_plot.png" alt="sample_plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 21:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Distinct-markers-attribute-color-when-labeling-only-certain/m-p/870255#M23695</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2023-04-17T21:03:55Z</dc:date>
    </item>
  </channel>
</rss>

