<?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 to color code a cell based on another variable value in proc report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915591#M360762</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'm not sure that the code you posted produces the output you showed. As an example, your PROC REPORT step shows&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1707748254545.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93566i87778A141D64985C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1707748254545.png" alt="Cynthia_sas_0-1707748254545.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You show a CAS variable and a LEVEL variable and an M1%, M2% and M3% in the DEFINE statements, but you show M1% 3 times in the COLUMN statement and so I would expect your code to generate errors and no color coding or error prone color coding at all. Your output shows SEG and AMOUNT variables, but those aren't the labels in the PROC&amp;nbsp; REPORT, so that is problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Are your percent variables (which you have labelled M1%, M2% M3%) character or numeric? Based on your IF statements, my suspicion is that they are numeric, but I also suspect your code has other issues. Are your variables really named M1%, M2% and M3%? I would expect those variable names to generate errors in the SAS Log. Also, your M1, M2 and M3 variables are definitely numeric, but you don't show any SAS format in the DEFINE statement that would format the numbers with a COMMA format. In addition, your IF statement treats M1% as numeric with a value of .95 and .90, etc, but again, there's no format being used in the PROC REPORT step to format the decimal number as a percent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Is it possible to see your SAS log that's generating the&amp;nbsp; results you posted?&amp;nbsp; I would be curious to see how your reference to M1%, M2%, etc is being handled.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; There are a few different ways to handle having the percent columns with the same background color as the M1, M2 and M3 variables. One way is to use another CALL DEFINE in the COMPUTE block and an alternate way is to use traffic-lighting with a user-defined format for the percent variables and then a simplified COMPUTE block for the M1, M2 and M3 values.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; With some fake data and different variable names, I think either of these examples will produce the report you want. Note that the second example has a simplified COMPUTE block, but the first example also works, although it is more verbose. ( I only typed a few rows of data since I had to make adjustments for the &amp;lt; and the % in the example data you posted.)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1707753542259.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93572i5FC4FBEA9D8CDBF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1707753542259.png" alt="Cynthia_sas_0-1707753542259.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2024 15:59:16 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2024-02-12T15:59:16Z</dc:date>
    <item>
      <title>How to color code a cell based on another variable value in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915515#M360748</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have a dataset with actual values and % values for each month as below&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="400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t;/P&gt;
&lt;P&gt;I need to color code both the columns M1 &amp;amp; M1% cells based on M1% column values. Let say if M1%&amp;gt;95% then green (both M1 &amp;amp; M1% cells); else if m1% &amp;gt;90% then orange; else red. The same format should apply for all the subsequent columns&amp;nbsp; as below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NagendraBS_0-1707726516900.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93545i244A84A7011C2DDB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NagendraBS_0-1707726516900.png" alt="NagendraBS_0-1707726516900.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did try using the PROC REPORT to achieve the result but unable to get color format for both actuals and percentage values at the same time in proc report. Below is snippet used to achieved the partial results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Query:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;proc report data=work.freq_accts;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;column cas level M1 M2 M1% M1% M2% M1%%;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;define cas / display 'CAS';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; define level / display 'Plan Amt';&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; define M1 / display '1Month' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; define M2 / display '2Months' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; define M3% / display '3Months' ;&lt;/P&gt;
&lt;P&gt;define M1% / display 'M1%' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; define M2% / display 'M2%' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; define M3% / display 'M3%' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;compute M1%;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if M1% &amp;gt; .95 then&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=light green}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if M1% &amp;gt; .90 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=light orange}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if M1% ne . then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=red}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endcomp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; compute M2%;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if M2% &amp;gt; .95 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M2', "style","style={background=light green}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if M2% &amp;gt; .90 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M2', "style","style={background=light orange}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if M2% ne . then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M2', "style","style={background=red}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endcomp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; compute M3%;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if M3% &amp;gt; .95 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=light green}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if M3% &amp;gt; .90 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=light orange}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; else if M3% ne . then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=red}");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; endcomp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on the above query able to get the results as below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NagendraBS_1-1707726516902.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93544i7F9D8CAF28FC29A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NagendraBS_1-1707726516902.png" alt="NagendraBS_1-1707726516902.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I wanted to color code the other columns as well based on the same condition. If not possible need to eliminate the % columns and keep the color format for actuals.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Neel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 08:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915515#M360748</guid>
      <dc:creator>NagendraBS</dc:creator>
      <dc:date>2024-02-12T08:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to color code a cell based on another variable value in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915591#M360762</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I'm not sure that the code you posted produces the output you showed. As an example, your PROC REPORT step shows&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1707748254545.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93566i87778A141D64985C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1707748254545.png" alt="Cynthia_sas_0-1707748254545.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You show a CAS variable and a LEVEL variable and an M1%, M2% and M3% in the DEFINE statements, but you show M1% 3 times in the COLUMN statement and so I would expect your code to generate errors and no color coding or error prone color coding at all. Your output shows SEG and AMOUNT variables, but those aren't the labels in the PROC&amp;nbsp; REPORT, so that is problematic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Are your percent variables (which you have labelled M1%, M2% M3%) character or numeric? Based on your IF statements, my suspicion is that they are numeric, but I also suspect your code has other issues. Are your variables really named M1%, M2% and M3%? I would expect those variable names to generate errors in the SAS Log. Also, your M1, M2 and M3 variables are definitely numeric, but you don't show any SAS format in the DEFINE statement that would format the numbers with a COMMA format. In addition, your IF statement treats M1% as numeric with a value of .95 and .90, etc, but again, there's no format being used in the PROC REPORT step to format the decimal number as a percent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Is it possible to see your SAS log that's generating the&amp;nbsp; results you posted?&amp;nbsp; I would be curious to see how your reference to M1%, M2%, etc is being handled.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; There are a few different ways to handle having the percent columns with the same background color as the M1, M2 and M3 variables. One way is to use another CALL DEFINE in the COMPUTE block and an alternate way is to use traffic-lighting with a user-defined format for the percent variables and then a simplified COMPUTE block for the M1, M2 and M3 values.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; With some fake data and different variable names, I think either of these examples will produce the report you want. Note that the second example has a simplified COMPUTE block, but the first example also works, although it is more verbose. ( I only typed a few rows of data since I had to make adjustments for the &amp;lt; and the % in the example data you posted.)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1707753542259.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93572i5FC4FBEA9D8CDBF1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1707753542259.png" alt="Cynthia_sas_0-1707753542259.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 15:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915591#M360762</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2024-02-12T15:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to color code a cell based on another variable value in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915592#M360763</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try adding this additional syntax to your compute blocks:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if M1% &amp;gt; .95 then do;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;call define ('M1', "style","style={background=light green}");&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; call define (_row_,'style','style={background=light green}';&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then repeat this code in the other percentage variables.&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 15:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915592#M360763</guid>
      <dc:creator>jeanleid</dc:creator>
      <dc:date>2024-02-12T15:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to color code a cell based on another variable value in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915630#M360776</link>
      <description>&lt;P&gt;Thanks a lot. Yes i did messed up in creating the fake data along with columns, but yeah got it right.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 17:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-color-code-a-cell-based-on-another-variable-value-in-proc/m-p/915630#M360776</guid>
      <dc:creator>NagendraBS</dc:creator>
      <dc:date>2024-02-12T17:38:15Z</dc:date>
    </item>
  </channel>
</rss>

