<?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: how do i alternate color for each new value? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651309#M24134</link>
    <description>&lt;P&gt;this is great ! thank you so much ! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 May 2020 07:14:51 GMT</pubDate>
    <dc:creator>nesslee</dc:creator>
    <dc:date>2020-05-28T07:14:51Z</dc:date>
    <item>
      <title>how do i alternate color for each new value?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651098#M24130</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I would like to alternate 2 colors in proc report for each new value in a column (row).&lt;/P&gt;&lt;P&gt;row&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;20&lt;/P&gt;&lt;P&gt;22&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;23&lt;/P&gt;&lt;P&gt;24&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so all rows with value=20 will have lightgray color&lt;/P&gt;&lt;P&gt;row with value=22 will have lightgreen color&lt;/P&gt;&lt;P&gt;all rows with value=23 will have lightgrey color&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;The values are not fixed. So I guess i have to first create a variable as compute variable (flag).&lt;/P&gt;&lt;P&gt;Can you please help ?&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;ods&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;listing&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;close&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;report&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=dupl &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;nowd&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;compute&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; call define(_row_, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"style"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"style=[background=lightgray]"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; flag=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;then&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; call define(_row_, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"style"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;, &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#800080"&gt;"style=[background=lightgreen]"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;endcomp&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3" color="#0000ff"&gt;ods&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;excel&lt;/FONT&gt; &lt;FONT face="Courier New" size="3" color="#0000ff"&gt;close&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 14:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651098#M24130</guid>
      <dc:creator>nesslee</dc:creator>
      <dc:date>2020-05-27T14:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: how do i alternate color for each new value?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651107#M24132</link>
      <description>&lt;P&gt;Hi &amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/137513"&gt;@nesslee&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a way to do this -&amp;gt; the idea is to compute a flag that changes each time there is a new value.&lt;BR /&gt;Depending on whether the flag is an odd or even number (cf. mod() function), the color changes.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dupl;
	input value;
	datalines;
20
20
20
22
23
23
24
	;
run;

data dupl2;
	set dupl;
	by value notsorted;
	if first.flag then flag=0;
	_lag = lag(value);
	if _lag ne value then flag+1;
run;

proc report data=dupl2 nowd;
	
	column value flag;
	
	define value / display;
	define flag / display noprint ;
	
	compute flag;
		if mod(flag,2)=1 then call define(_row_, "style", "style=[background=lightgray]");
		else call define(_row_, "style", "style=[background=lightgreen]");
	endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Capture d’écran 2020-05-27 à 17.04.46.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40038i5E1BF86CEA18789E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-05-27 à 17.04.46.png" alt="Capture d’écran 2020-05-27 à 17.04.46.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2020 15:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651107#M24132</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-27T15:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: how do i alternate color for each new value?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651309#M24134</link>
      <description>&lt;P&gt;this is great ! thank you so much ! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 07:14:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651309#M24134</guid>
      <dc:creator>nesslee</dc:creator>
      <dc:date>2020-05-28T07:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: how do i alternate color for each new value?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651321#M24135</link>
      <description>&lt;P&gt;You're welcome&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/137513"&gt;@nesslee&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 07:54:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/how-do-i-alternate-color-for-each-new-value/m-p/651321#M24135</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-28T07:54:19Z</dc:date>
    </item>
  </channel>
</rss>

