<?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: Unable to get purple flag or ribbon in below plot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978314#M378597</link>
    <description>&lt;P&gt;It looks like you have a discrete scale of colors. If so, use the KEYLEGEND statement in PROC SGPLOT. If you have a continuous color ramp, use the GRADLEGEND statement. For an example, see&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2021/03/01/wind-chill-chart-sas.html" target="_blank"&gt;Create a wind chill chart in SAS - The DO Loop&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Nov 2025 14:52:53 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2025-11-04T14:52:53Z</dc:date>
    <item>
      <title>Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978285#M378592</link>
      <description>&lt;PRE&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you assist me in adding purple flag/ribbon in below plot.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WhatsApp Image 2025-11-03 at 8.51.29 PM.jpeg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111125i13A14EA0D09D9746/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WhatsApp Image 2025-11-03 at 8.51.29 PM.jpeg" alt="WhatsApp Image 2025-11-03 at 8.51.29 PM.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 10:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978285#M378592</guid>
      <dc:creator>Anv_SAS</dc:creator>
      <dc:date>2025-11-04T10:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978306#M378593</link>
      <description>&lt;P&gt;Example data in the form of a working data step and the code used to create the plot you have is a good way to ask a question. Without your code we don't know the options that may be available in the procedure to add stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where would the purple flag go?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 11:28:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978306#M378593</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-11-04T11:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978314#M378597</link>
      <description>&lt;P&gt;It looks like you have a discrete scale of colors. If so, use the KEYLEGEND statement in PROC SGPLOT. If you have a continuous color ramp, use the GRADLEGEND statement. For an example, see&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2021/03/01/wind-chill-chart-sas.html" target="_blank"&gt;Create a wind chill chart in SAS - The DO Loop&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 14:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978314#M378597</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2025-11-04T14:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978367#M378599</link>
      <description>And what is your desired output format ?&lt;BR /&gt;Excel ,PDF or  just a Graph ?</description>
      <pubDate>Wed, 05 Nov 2025 08:54:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978367#M378599</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-11-05T08:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978368#M378600</link>
      <description>Looks like you want a margin freq histogram. Check this:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2017/06/26/advanced-ods-graphics-range-attribute-maps/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2017/06/26/advanced-ods-graphics-range-attribute-maps/&lt;/A&gt;</description>
      <pubDate>Wed, 05 Nov 2025 08:59:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978368#M378600</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-11-05T08:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978492#M378609</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find enclosed piece of code and output. However, in layout if you observed there is a purple/red flag above the subject/pid. It is the scheme of drug administered (in no. of drops) from week 1 to week&amp;nbsp; 22. I'm unable to add that flag to the plot.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 05:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978492#M378609</guid>
      <dc:creator>Anv_SAS</dc:creator>
      <dc:date>2025-11-07T05:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978495#M378611</link>
      <description>You just show us there is a purple flag, but didn't tell us how to get it. &lt;BR /&gt;Does this flag stand for anything ?</description>
      <pubDate>Fri, 07 Nov 2025 06:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978495#M378611</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-11-07T06:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978497#M378612</link>
      <description>&lt;P&gt;Assuming this purple flag does not mean anything. Just for an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dm 'log;clear;odsresults;clear;';

proc datasets lib=work kill mt=data nolist nodetails nowarn;
quit;

/**************************************************************
				Heatmap plot
**************************************************************/

data sample;
	infile cards dlm=",";
	input subjid :$10. drops week;
cards;
101,2,1
101,4,2
101,3,3
101,.,4
101,1,5
101,2,6
101,1,7
101,2,8
102,3,1
102,1,2
102,2,3
102,.,4
102,4,5
102,1,6
103,2,1
103,4,2
103,3,3
103,4,4
103,1,5
103,2,6
103,3,7
103,2,8
104,2,1
104,4,2
104,3,3
104,.,4
104,.,5
104,1,6
;
run;
data flag;
zero=0;
do week2=0 to 8.5 by 0.5;
  y=(9-week2)/9;output;
end;
run;

data sample;
length colormodel $20.;;
	set sample flag;
	if drops ne . then dropc = strip(put(drops,??best.));
	else dropc="0";
	if drops=. then drops=0;
	if drops=4 then colormodel="CX004080";
	else if drops=3 then colormodel="CX3399CC";
	else if drops=2 then colormodel="CX66B2CC";
	else if drops=1 then colormodel="CX99CCDD";
	else if drops in (.,0) then colormodel="CXFFFFFF";
run;

proc sort data=sample out=attrid nodupkey;
	by drops;
	where drops ne .;
run;

data attrid;
set attrid;
	id="dps";
	value=drops;
	fillcolor=colormodel;
run;

title1 j=c "Headmap Plot";
title2 j=c "Practice plot2";

title3 " ";
ods graphics on / border=off width=24cm height=11cm;

proc sgplot data=sample noautolegend nowall dattrmap=attrid;
	    heatmapparm x=week y=subjid    
	    colorgroup=drops/outlineattrs=(color=gray) name="dps" transparency=0.1 x2axis attrid=dps; 
	    text x=week y=subjid text=dropc / x2axis textattrs=(size=8pt weight=bold);   

        band x=week2 lower=zero upper=y/y2axis fill fillattrs=(color=purple) transparency=0.6; 
        y2axis display=none offsetmin=0.82 offsetmax=0.02;

	    yaxis label="Subject" offsetmin=0.3 
	    labelpos=center reverse;  
	    x2axis values=(1,2,3,4,5,6,7,8) label="Week" offsetmin=0.06 offsetmax=0.06;
		xaxis display=none ;
		keylegend "dps"/noborder title="Number of drops per week" sortorder=descending;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1762501495393.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111206iB115937F001E0864/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1762501495393.png" alt="Ksharp_0-1762501495393.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2025 07:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978497#M378612</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-11-07T07:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to get purple flag or ribbon in below plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978505#M378614</link>
      <description>Thanks Ksharp, For you quick response. The logic and band statement portrait looks good.&lt;BR /&gt;&lt;BR /&gt;Thanks once again.</description>
      <pubDate>Fri, 07 Nov 2025 11:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-get-purple-flag-or-ribbon-in-below-plot/m-p/978505#M378614</guid>
      <dc:creator>Anv_SAS</dc:creator>
      <dc:date>2025-11-07T11:07:39Z</dc:date>
    </item>
  </channel>
</rss>

