<?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 can I incorporate Excel like data bars in ODS Output? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970794#M26909</link>
    <description>&lt;P&gt;Very nice&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would be good to wrap the macro call in the CALL EXECUTE inside %NRSTR(), to avoid the call execute timing issue where it will try to resolve &amp;amp;max before the macro variable has been created.&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute(catt('%nrstr(%get_bar)(value=',a,',imagename=',a,')'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would also explicitly make &amp;amp;max a local variable (it should be local when the timing works out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I were making the bars, in the sgplot I would rather set xaxis max=1, so that when the actual/goal is 50% the bar takes up 50% of the space.&amp;nbsp; But what you've done is consistent with what the OP asked for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nicely done!&lt;/P&gt;</description>
    <pubDate>Tue, 15 Jul 2025 13:36:22 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2025-07-15T13:36:22Z</dc:date>
    <item>
      <title>How can I incorporate Excel like data bars in ODS Output?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970732#M26905</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I need to convert an Excel report into SAS. I suspect I can create the 4 side by side charts (or think I know how I'm going to attack it), but how do I create the data bars? I tried finding examples but can't seem to find any. Can someone provide sample code or point me to sample code and output? The desired output is to be in PDF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paula&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASGeek_0-1752515725673.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108343iFAF4106FA23B15DD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASGeek_0-1752515725673.png" alt="SASGeek_0-1752515725673.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 17:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970732#M26905</guid>
      <dc:creator>SASGeek</dc:creator>
      <dc:date>2025-07-14T17:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I incorporate Excel like data bars in ODS Output?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970734#M26906</link>
      <description>&lt;P&gt;The following paper may be a starting point:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings09/221-2009.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings09/221-2009.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a similar Communities post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-Colour-Columns-as-Data-Bars-and-by-Using-Conditional/td-p/254871" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-Colour-Columns-as-Data-Bars-and-by-Using-Conditional/td-p/254871&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 18:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970734#M26906</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2025-07-14T18:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How can I incorporate Excel like data bars in ODS Output?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970735#M26907</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-Colour-Columns-as-Data-Bars-and-by-Using-Conditional/td-p/254871" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-Colour-Columns-as-Data-Bars-and-by-Using-Conditional/td-p/254871&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jul 2025 18:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970735#M26907</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-07-14T18:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I incorporate Excel like data bars in ODS Output?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970765#M26908</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input a $ actual goal   ;
v=actual/goal;
format v percent7.1;
cards;
a 850 1200
b 150 1500
c 450 1600 
d 650 1000
;
proc sql;
create table _a as
select *,max(v) as max from a;

create table want as
select * from _a
union all
select 'TOTALS',sum(actual),sum(goal),sum(actual)/sum(goal),. from _a
;
quit;


%let path=c:\temp\;  *the path name stored image;
%macro get_bar(value=,imagename=);
data _null_;
set _a;
if _n_=1 then call symputx('max',max);
run;
ods _all_ close;
ods listing gpath="&amp;amp;path." image_dpi=300;
ods graphics /noborder reset=index width=100px height=15px imagename="&amp;amp;imagename" outputfmt=png;
proc sgplot data=_a noborder noautolegend ;
where a="&amp;amp;value.";
hbarparm category=a response=v/ filltype=GRADIENT displaybaseline=off
 barwidth=1 outlineattrs=(color=green) fillattrs=(color=white) fillendcolor=green;
scatter x=max y=a/datalabel=v labelstrip  datalabelpos=left datalabelattrs=(size=22) markerattrs=(size=0);
xaxis min=0 max=&amp;amp;max. offsetmin=0 offsetmax=0 display=none;
yaxis offsetmin=0 offsetmax=0 display=none;
run;
%mend;
data _null_;
set a;
call execute(catt('%nrstr(%get_bar)(value=',a,',imagename=',a,')'));
run;

ods pdf file='c:\temp\want.pdf' style=htmlblue dpi=300;
proc report data=want nowd style(header)=header ;
column ('Region' a  actual goal v dummy);
define a/display;
define dummy/computed '%Covered' ;
define v/display noprint;
compute dummy/character length=10 ;
 dummy=' ';
 if a ne 'TOTALS' then call define(_col_,'style',"style={preimage='c:\temp\"||strip(a)||".png'}");
  else do;dummy=vvalue(v);call define(_row_,'style','style=header');call define(_col_,'style','style=header{just=r}');end;
endcomp;
run;
ods pdf close;&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-1752558580379.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/108366i75C5ACBF8DFCF9AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1752558580379.png" alt="Ksharp_0-1752558580379.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>Wed, 16 Jul 2025 01:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970765#M26908</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-07-16T01:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I incorporate Excel like data bars in ODS Output?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970794#M26909</link>
      <description>&lt;P&gt;Very nice&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would be good to wrap the macro call in the CALL EXECUTE inside %NRSTR(), to avoid the call execute timing issue where it will try to resolve &amp;amp;max before the macro variable has been created.&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute(catt('%nrstr(%get_bar)(value=',a,',imagename=',a,')'));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I would also explicitly make &amp;amp;max a local variable (it should be local when the timing works out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I were making the bars, in the sgplot I would rather set xaxis max=1, so that when the actual/goal is 50% the bar takes up 50% of the space.&amp;nbsp; But what you've done is consistent with what the OP asked for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nicely done!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jul 2025 13:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970794#M26909</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-07-15T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: How can I incorporate Excel like data bars in ODS Output?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970839#M26910</link>
      <description>Yeah. You are right. I must forgot to check the LOG . Code has been updated . Thx!</description>
      <pubDate>Wed, 16 Jul 2025 01:06:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-can-I-incorporate-Excel-like-data-bars-in-ODS-Output/m-p/970839#M26910</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-07-16T01:06:18Z</dc:date>
    </item>
  </channel>
</rss>

