<?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: Variable length sliders for percentages in Proc Report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316357#M17435</link>
    <description>&lt;P&gt;This looks somewhat promising, however, when running through the data _null_ step, the files being created are Alice1.png (instead of simply 'Alice.png'). I don't see why it is adding the number for me, and I've even restarted SAS with the same results.&lt;BR /&gt;&lt;BR /&gt;As a result of this, the output shows 'missing image'.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Dec 2016 19:15:34 GMT</pubDate>
    <dc:creator>GregG</dc:creator>
    <dc:date>2016-12-02T19:15:34Z</dc:date>
    <item>
      <title>Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/315970#M17415</link>
      <description>&lt;P&gt;Following this slide show, trying to get slider bars that change in length based on percentages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.slideshare.net/eagebhart/proc-report/18" target="_blank"&gt;http://www.slideshare.net/eagebhart/proc-report/18&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Slide 18 shows the code added to Proc Report and slide 19 shows the output (I've also attached an image of the output).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code I'm trying (and below are my issues):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ods tagsets.slider file='example6.html' style=slider;&lt;BR /&gt;*ods pdf file='output.pdf';

proc report data=sashelp.class nowd;
	columns sex name age height weight weight=weight2 weight_pct;
	define name			/ display 'Name' width=10;
	define sex			/ group	'Gender' width=6;	
	define age			/ display 'Age' width=4;
	define height		/ analysis mean 'Height' format=8.1;
	define weight		/ analysis noprint 'Weight' format=8.1;
	define weight2		/ analysis mean 'Weight' format=8.1;
	define weight_pct	/ computed '% of Weight' format=percent6. left style(column)=bar[tagattr="slider"];

	compute weight_pct;
		weight_pct = weight.sum/weight_sum;
	endcomp;

	compute before sex;
		weight_sum=weight.sum;
	endcomp;

	break after sex / summarize style=header;
run;

*ods pdf close;&lt;/PRE&gt;
&lt;P&gt;Here are the issues I'm having:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;nbsp;In the Results Viewer window as well as the example6.html file, there is what appears to be a place for the bar, but no actual bar. (Looks like image missing). Edit - looking at the source of the .html file, it is calling bar.png - this file is in the folder of the output.&lt;/LI&gt;
&lt;LI&gt;I'd prefer to output this to .pdf instead of .html&lt;/LI&gt;
&lt;/UL&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13215i8FE00A0CF6242C94/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="proc-report-19-638.jpg" title="proc-report-19-638.jpg" /&gt;</description>
      <pubDate>Thu, 01 Dec 2016 15:31:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/315970#M17415</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2016-12-01T15:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316053#M17421</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;&amp;nbsp; That author created a custom TAGSET template called TAGSETS.SLIDER in order to create that output. The challenge with your desire to make create this output in PDF is that PDF is NOT a "tagset" destination. So, you can't do in PDF what you can do in either HTML or XML with a TAGSET.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; As for why the image doesn't show, it is probably a mismatch between the path where bar.png is stored and the path where the browser looks for it.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; The bottom line is that the TAGSETS approach will not work for PDF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 19:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316053#M17421</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-12-01T19:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316056#M17422</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the bar.png, example6.html (output), and slider.sas (program name of the code I provided here) all in the same folder. Where else would I set the location of the bar.png so that example6.html use the correct path? (again, example6.html &amp;amp; bar.png are in the same directory and viewing the source on example6.html shows it calling 'bar.png' - no other path details).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know of a way to do this in .pdf directly from SAS?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 19:18:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316056#M17422</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2016-12-01T19:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316112#M17430</link>
      <description>&lt;P&gt;I can think of 2 possibilities:&lt;/P&gt;
&lt;P&gt;1) use a font character (Thorndale AMT has a "full block" character that, when you "stack" them side by side look like a full bar)&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;2) create a bar with SAS (probably SGPLOT) and then generate small images insert the images into your table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Approach #1 is illustrated here:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6185i98A80E5A6C607834/image-size/original?v=v2&amp;amp;px=-1" alt="with_font_char.png" title="with_font_char.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Approach #2 is illustrated here:&amp;nbsp; &lt;A href="http://support.sas.com/resources/papers/proceedings13/212-2013.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings13/212-2013.pdf&lt;/A&gt; -- where the author has a trend line plot image in the table, you would replace this with a bar chart.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6186i50E28B1F4D64B68D/image-size/original?v=v2&amp;amp;px=-1" alt="louise_sparkline.png" title="louise_sparkline.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6187i67135789A37703A7/image-size/original?v=v2&amp;amp;px=-1" alt="using_images_in_report.png" title="using_images_in_report.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 23:18:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316112#M17430</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-12-01T23:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316243#M17434</link>
      <description>&lt;PRE&gt;

I love this question.
Check the attachment.




proc sql;
create table temp as
select *,weight/sum(weight) as per format=percent7.
 from sashelp.class as a
  group by sex;
quit;


ods listing gpath='/folders/myfolders/' image_dpi=300  ;
%macro hbar(name=);
ods graphics/reset height=20px width=100px imagename="&amp;amp;name" noborder ;
proc sgplot data=temp(where=(name="&amp;amp;name")) noborder ;
 hbar name/response=per datalabel baselineattrs=(thickness=0)
   nooutline;
 xaxis display=none values=(0 to 1 by 0.1) offsetmax=0 offsetmin=0;
 yaxis display=none offsetmax=0 offsetmin=0;
run;
%mend;

data _null_;
 set temp;
 call execute(cats('%hbar(name=',name,')'));
run;


ods pdf file='/folders/myfolders/want.pdf' dpi=300;
proc report data=sashelp.class nowd out=x;
	columns sex name age height weight weight=weight2 weight_pct picture;
	define name			/ display 'Name' width=10;
	define sex			/ group	'Gender' width=6;	
	define age			/ display 'Age' width=4;
	define height		/ analysis mean 'Height' format=8.1;
	define weight		/ analysis noprint 'Weight' format=8.1;
	define weight2		/ analysis mean 'Weight' format=8.1;
	define weight_pct	/ computed '% of Weight' format=percent6. left style(column)=bar[tagattr="slider"];

    define picture/computed ;
    compute picture/character length=40;
     if lowcase(_break_) ne 'sex' then
     call define(_col_,'style',cats('style={preimage="/folders/myfolders/',name,'.png"}'));
    endcomp;

	compute weight_pct;
		weight_pct = weight.sum/weight_sum;
	endcomp;

	compute before sex;
		weight_sum=weight.sum;
	endcomp;

	break after sex / summarize style=header;
run;
ods pdf close;



&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Dec 2016 13:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316243#M17434</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-12-02T13:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316357#M17435</link>
      <description>&lt;P&gt;This looks somewhat promising, however, when running through the data _null_ step, the files being created are Alice1.png (instead of simply 'Alice.png'). I don't see why it is adding the number for me, and I've even restarted SAS with the same results.&lt;BR /&gt;&lt;BR /&gt;As a result of this, the output shows 'missing image'.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 19:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316357#M17435</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2016-12-02T19:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316375#M17437</link>
      <description>Typically, if there is an existing file named Alice.png, then a new, numbered file will be created. You can generally restart the numbering by doing this:&lt;BR /&gt;ods graphics /reset=all;&lt;BR /&gt;or&lt;BR /&gt;ods graphics / reset=index;&lt;BR /&gt;&lt;BR /&gt;Usually, I go out and delete all the stray PNG files when I am doing multiple runs of the same program to avoid the numbering issue.&lt;BR /&gt;cynthia</description>
      <pubDate>Fri, 02 Dec 2016 20:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316375#M17437</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-12-02T20:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316380#M17438</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There were no files with these names in the directory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the ods graphics /reset=all; sounds like it may help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, for your solution above using Thorndale AMT, it is printing:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode&lt;BR /&gt;2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode&lt;BR /&gt;2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588) ^(unicode 2588)&lt;BR /&gt;67.26%&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the pchar column. I verified that I have Thorndale AMT installed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wasn't sure how to implement your second alternative, but thank you again for all of your help.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2016 20:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316380#M17438</guid>
      <dc:creator>GregG</dc:creator>
      <dc:date>2016-12-02T20:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Variable length sliders for percentages in Proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316391#M17440</link>
      <description>&lt;P&gt;Hi: for the Thorndale AMT example to work, you need to be sure you have an ODS ESCAPECHAR statement before you use the data:&lt;BR /&gt;ods escapechar='^';&lt;BR /&gt;&lt;BR /&gt;My approach to the second alternative was similar to Ksharp's method, I just did not macro-ize the code. I will dig it up and post it.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's all the code I used:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** Make Test Data;
data testdata;
length pchar $4000 unibar $15 plabl $9;
  retain unibar '^{unicode 2588}';
  set sashelp.class;
  where age in (12,13);
  percent=height/weight;
  plabl = put(percent,percent9.2);
  pround = round((percent*25),1);
  pchar = catt(repeat(unibar,pround),put(percent,percent9.2));
  put _all_;
run;
 
**1)  Thorndale AMT approach works for me in ODS PDF and ODS HTML;
ods escapechar='^';
ods html file='c:\temp\bar_with_font.html' style=htmlblue;
ods pdf file='c:\temp\bar_with_font.pdf';
proc report data=testdata;
  column name age sex height weight percent pchar;
  define pchar / style(column)={color=red font_face='Thorndale AMT'};
format percent percent9.2;
run;
ods pdf close;
ods html close;

** 2)  make an image using SGPLOT approach;
**     be sure to create images are in c:\temp using GPATH=;
ods html path='c:\temp' (url=none)
         gpath='c:\temp' (url=none)
         file='checkbars.html';

** make images fairly small to fit in final table;
** run one SGPLOT for every student;
** could "macro-ize" this piece of code;
ods graphics / reset=all height=.5in width=3.5in imagename="Alice" imagefmt=png;
proc sgplot data=testdata noborder;
  where name = "Alice";
  hbar name / response=percent name="Alice"
       dataskin=matte
       datalabel=plabl 
       datalabelattrs=(Color=Navy Family='Courier New' Size=14 )
       datalabelfitpolicy=none;
  xaxis values=(0 to 1 by .1) display=none;
  yaxis display=none;
run;

ods graphics / height=.5in width=3.5in imagename="John" imagefmt=png;
proc sgplot data=testdata noborder;
  where name = "John";
  hbar name / response=percent name="John"
       dataskin=matte
       datalabel=plabl 
       datalabelattrs=(Color=Navy Family='Courier New' Size=14 )
       datalabelfitpolicy=none;
  xaxis values=(0 to 1 by .1) display=none;
  yaxis display=none;
run;

ods graphics / height=.5in width=3.5in imagename="Robert" imagefmt=png;
proc sgplot data=testdata noborder;
  where name = "Robert";
  hbar name / response=percent name="Robert"
       dataskin=matte
       datalabel=plabl 
       datalabelattrs=(Color=Navy Family='Courier New' Size=14 )
       datalabelfitpolicy=none;
  xaxis values=(0 to 1 by .1) display=none;
  yaxis display=none;
run;

ods html close;

** not entirely happy with resolution of datalabel in PDF output;
** but I would probably work with Tech Support on how to improve that;
** or design the report so that percent was in a separate column;

ods html gpath='c:\temp' (url=none)
         path='c:\temp' (url=none)
		 file = 'final.html';

ods pdf file='c:\temp\final.pdf';
proc report data=testdata
     style(column)={vjust=m};
  where name in ('Alice' 'Robert' 'John');
  column name age sex height weight percent pcell;
  define pcell / computed;
  compute pcell;
     pcell = ' ';     
     if name = 'Alice' then do;
	    call define(_col_,'style','style={preimage="c:\temp\Alice.png"}');
     end;
     else if name = 'John' then do;
	    call define(_col_,'style','style={preimage="c:\temp\John.png"}');
     end;
     else if name = 'Robert' then do;
	    call define(_col_,'style','style={preimage="c:\temp\Robert.png"}');
     end;
  endcomp;
format percent percent9.2;
run;

ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Dec 2016 21:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Variable-length-sliders-for-percentages-in-Proc-Report/m-p/316391#M17440</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-12-02T21:23:18Z</dc:date>
    </item>
  </channel>
</rss>

