<?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 highlight specific cells of summary data for excel output? Character and Numeric! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866640#M342262</link>
    <description>&lt;P&gt;Perhaps because the COLUMNS statement appears twice in your code?&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 21:22:07 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-03-27T21:22:07Z</dc:date>
    <item>
      <title>How do I highlight specific cells of summary data for excel output? Character and Numeric!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866611#M342246</link>
      <description>&lt;P&gt;Hi SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm creating an automated monthly report and my customer recently reached out and wanted to highlight specific cells of data in the summary sheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this example, I am using sashelp.cars as my dataset. But here is a sample of what my customer is looking for:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mreynaud_0-1679944099483.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82110i9D67660BD7701416/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mreynaud_0-1679944099483.png" alt="mreynaud_0-1679944099483.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;They want to highlight the "Is this car an Audi?" record if it equals "Yes" AND if the&amp;nbsp;"Is this car an Audi?" equals "Yes" then highlight the "Count" record as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attempted to follow samples from &lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/how-to-color-excel-output/td-p/344340" target="_self"&gt;this forum&lt;/A&gt; but I had a hard time adapting it since my columns are character and numerical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is some sample code that will generate the summary tables from sashelp.cars and excel output. It would be so helpful if you can adapt it to highlight specific records!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/*Flag Car Type*/
data car_type;
set sashelp.cars;
if make="Audi" then is_audi="Yes";
run;

data car_type_2;
set car_type;
if is_audi=" " then is_audi="No";
run;

/*Create Summary Table*/
proc freq data=car_type_2; 
table is_audi/ out=audi_freq;
run;

/*Create Grand Total row*/
proc means noprint data=audi_freq;
  output out=summary sum=;
run;

data car_total;
  set audi_freq summary (in=in2);
  if in2 then Grand_Total='Grand Total:';
run;

/*Build Excel report*/

ODS listing close;
ODS excel FILE=&amp;amp;resultfile STYLE=htmlblue
options(embedded_titles='yes' embedded_footnotes='yes' zoom='100' sheet_interval='none' sheet_name='Summary' suppress_bylines='yes'  
orientation='landscape' fittopage="no" Pages_FitWidth = '2' Pages_FitHeight = '4' autofilter='yes' 	row_repeat='header'
 embedded_footnotes='yes');
 
proc report data=car_total split='@';

TITLE "Car Summary";

COLUMN (Grand_Total is_audi COUNT PERCENT);

DEFINE Grand_Total / DISPLAY ' ';
DEFINE is_audi / DISPLAY 'Is this car an Audi?';
DEFINE COUNT / DISPLAY 'Count' format=Comma10.0;
DEFINE PERCENT / DISPLAY 'Percent %' format=Comma10.3;

run;
TITLE;
ods excel options(sheet_interval='none');&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Note: This code should work w/o errors, but be sure to set your own file pathway for the excel output&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 19:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866611#M342246</guid>
      <dc:creator>mreynaud</dc:creator>
      <dc:date>2023-03-27T19:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I highlight specific cells of summary data for excel output? Character and Numeric!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866615#M342249</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=car_total;
    columns grand_total is_audi count percent;
    compute is_audi;
        if is_audi='Yes' then call define(_col_,'style','style={background=yellow}');
    endcompute;
    compute count;
        if is_audi='Yes' then call define(_col_,'style','style={background=yellow}');
    endcompute;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Mar 2023 19:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866615#M342249</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-27T19:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I highlight specific cells of summary data for excel output? Character and Numeric!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866639#M342261</link>
      <description>&lt;P&gt;Thank you for the help! It worked but it duplicated the table... Very strange&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mreynaud_0-1679951723194.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82111iF846DB611BA47329/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mreynaud_0-1679951723194.png" alt="mreynaud_0-1679951723194.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here was what I ran for the report portion:&lt;/P&gt;&lt;PRE&gt;ODS listing close;
ODS excel FILE=&amp;amp;resultfile STYLE=htmlblue
options(embedded_titles='yes' embedded_footnotes='yes' zoom='100' sheet_interval='none' sheet_name='Summary' suppress_bylines='yes'  
orientation='landscape' fittopage="no" Pages_FitWidth = '2' Pages_FitHeight = '4' autofilter='yes' 	row_repeat='header'
 embedded_footnotes='yes');
 
proc report data=car_total split='@';

TITLE "Car Summary";

COLUMN (Grand_Total is_audi COUNT PERCENT);

DEFINE Grand_Total / DISPLAY ' ';
DEFINE is_audi / DISPLAY 'Is this car an Audi?';
DEFINE COUNT / DISPLAY 'Count' format=Comma10.0;
DEFINE PERCENT / DISPLAY 'Percent %' format=Comma10.3;
columns grand_total is_audi count percent;

compute is_audi;
if is_audi='Yes' then call define(_col_,'style','style={background=yellow}');
    endcomp;
compute count;
        if is_audi='Yes' then call define(_col_,'style','style={background=yellow}');
    endcomp;
run;
TITLE;
ods excel options(sheet_interval='none');&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Mar 2023 21:18:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866639#M342261</guid>
      <dc:creator>mreynaud</dc:creator>
      <dc:date>2023-03-27T21:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do I highlight specific cells of summary data for excel output? Character and Numeric!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866640#M342262</link>
      <description>&lt;P&gt;Perhaps because the COLUMNS statement appears twice in your code?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 21:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866640#M342262</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-27T21:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I highlight specific cells of summary data for excel output? Character and Numeric!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866641#M342263</link>
      <description>Silly me! Thank you so much</description>
      <pubDate>Mon, 27 Mar 2023 21:25:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-highlight-specific-cells-of-summary-data-for-excel/m-p/866641#M342263</guid>
      <dc:creator>mreynaud</dc:creator>
      <dc:date>2023-03-27T21:25:35Z</dc:date>
    </item>
  </channel>
</rss>

