<?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: Proc Report, sparklines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238400#M43808</link>
    <description>&lt;P&gt;Here's a mock-up of the report I am trying to build.&lt;/P&gt;
&lt;P&gt;Large teams could take up to 3 pages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12119iB6637FE04043567B/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="fake report.png" title="fake report.png" /&gt;</description>
    <pubDate>Tue, 08 Dec 2015 22:44:01 GMT</pubDate>
    <dc:creator>morglum</dc:creator>
    <dc:date>2015-12-08T22:44:01Z</dc:date>
    <item>
      <title>Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238181#M43729</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I am both a Proc REPORT and a &lt;A href="http://support.sas.com/resources/papers/proceedings12/084-2012.pdf" target="_self"&gt;sparklines&lt;/A&gt; &amp;nbsp;&amp;nbsp;newbie.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am currently working on a report that will display information about workers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to display a row for each workers, showing whether or not they achieved their weekly objectifve. &amp;nbsp;This would simply involve displaying &amp;nbsp;columns, one for the objective (Say 20 sales) and the&amp;nbsp;result (say 23 sales). &amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also like to display a&amp;nbsp;win-loss sparkline showing whether or not thelast 52 weekly objectives have been met or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Workers have a few of these weekly objectives, but being able to display 3 of them on a single row would be perfect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;A manager can have between 10 and 20 workers, so I believe this should be able to fit in a single page.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;How would you proceed? &amp;nbsp; &amp;nbsp;So far, my best &amp;nbsp;idea would be to generate a sparkline "winloss" GIF&amp;nbsp;using the %SPARKY macro linked above and inserting them in the proc report.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas would be very welcome.&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;cheers!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 20px;"&gt;bonus question: &amp;nbsp;Can I do a proc report "by ManagerID", or do I have to run it separately for each MAnagerID ?&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, 07 Dec 2015 22:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238181#M43729</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-07T22:10:12Z</dc:date>
    </item>
    <item>
      <title>Minimal working example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238383#M43797</link>
      <description>&lt;P&gt;Alright, I've found a 2012 PharmaSUG China paper that has a good start for me.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lexjansen.com/pharmasug-cn/2012/papers/PharmaSUG_China_2012_d2.pdf" target="_self"&gt;Using PROC REPORT and ODS for Customized Presentation of Study Results and for Medical Informatics Sparklines Jim Sattler, Satmari Software Systems, Inc., Philippines&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've build a minimal working example (attached), that created sparklines for 25 records and display them next to the worker.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The report adds a line above and below the PNG, which makes for needlessly "high" cells. &amp;nbsp;It is easily seen in the RTF file. &amp;nbsp;Is there a way to fix this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The sparklines look terrible (low resolution) in the PDF created. &amp;nbsp;My output will have to be a PDF, is there a good way to fix thix?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;EDIT: &amp;nbsp;attaching the file didnt work, so here is the code:&lt;/P&gt;
&lt;P&gt;*******************************************************************************************************************************************************&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data temp;&lt;BR /&gt;do subjidn= 1 to 25 by 1;&lt;BR /&gt; do t=1 to 10;&lt;BR /&gt; y=(5+subjidn-t)**2+50;&lt;BR /&gt; output;&lt;BR /&gt; end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data temp;&lt;BR /&gt;set temp;&lt;BR /&gt;obs= _n_;&lt;BR /&gt;run;&lt;BR /&gt;title1;&lt;/P&gt;
&lt;P&gt;/*MACRO WITH POSITIONAL PARAMETERS USED IN THE PRORAM*/&lt;BR /&gt;%macro sparkline (data_set, var_name, upper_limit, lower_limit, minmax);&lt;BR /&gt;**varname is the name of the Y variable;&lt;BR /&gt;** upper limit is either the 75TH percentile (75TH) or a hardcoded number;&lt;BR /&gt;** lower limit is either the 25TH percentile (25TH) or a hardcoded number;&lt;BR /&gt;** if MINMAX = "YES" then the minimum and maximum values are identified with a colored dot;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/*CREATE SUMMARY VARIABLES FOR EACH PATIENT*/&lt;BR /&gt;proc means data=&amp;amp;data_set noprint;&lt;BR /&gt;var &amp;amp;var_name;&lt;BR /&gt;class subjidn;&lt;BR /&gt;output out=avg(where=(_TYPE_=1)) mean=avg p25=p25 p75=p75 min=min max=max;&lt;BR /&gt;run;&lt;BR /&gt;/*CREATE MACRO VARIABLES FOR PATIENTS FROM SUMMARY VARIABLES*/&lt;BR /&gt;data _null_;&lt;BR /&gt;set avg end=lastrec;&lt;BR /&gt;call symputx('patient'||left(_N_),subjidn);&lt;BR /&gt;if lastrec then call symputx('numpts',_n_);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;/*CREATE MACRO VARIABLES FOR THE SUMMARY STATISTICS*/&lt;BR /&gt;/*ITERATE FOR THE NUMBER OF PATIENTS COMPUTED ABOVE*/&lt;BR /&gt;%do i=1 %to &amp;amp;numpts;&lt;BR /&gt;data _null_;&lt;BR /&gt;set avg;&lt;BR /&gt;where subjidn=&amp;amp;&amp;amp;patient&amp;amp;i;&lt;BR /&gt;call symputx('avg',avg);&lt;BR /&gt;call symputx('p25',p25);&lt;BR /&gt;call symputx('p75',p75);&lt;BR /&gt;call symputx('min',min);&lt;BR /&gt;call symputx('max',max);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/*CONVERT MACRO SUMMARY STATISTICS VARIABLES INTO INPUT VARIABLES FOR SPARKLINE&lt;BR /&gt;GRAPHICS*/&lt;BR /&gt;data spark;&lt;BR /&gt;retain labtest;&lt;BR /&gt;set &amp;amp;data_set(where=(subjidn=&amp;amp;&amp;amp;patient&amp;amp;i)) end=last;&lt;BR /&gt;if &amp;amp;var_name ne . then labtest=&amp;amp;var_name;&lt;BR /&gt;minmax="&amp;amp;minmax";&lt;BR /&gt;if (minmax="YES" &amp;amp; &amp;amp;var_name=&amp;amp;min) then min=&amp;amp;min;&lt;BR /&gt;if (minmax="YES" &amp;amp; &amp;amp;var_name=&amp;amp;max) then max=&amp;amp;max;&lt;BR /&gt;u="&amp;amp;upper_limit";&lt;BR /&gt;if u='75TH' then ul=&amp;amp;p75;&lt;BR /&gt;else ul="&amp;amp;upper_limit";&lt;BR /&gt;l="&amp;amp;lower_limit";&lt;BR /&gt;if l='25TH' then ll=&amp;amp;p25;&lt;BR /&gt;else ll="&amp;amp;lower_limit";&lt;BR /&gt;x=_n_;&lt;BR /&gt;z=&amp;amp;avg.;&lt;BR /&gt;if last then e=labtest;&lt;BR /&gt;call symputx('lastone',round(e,0.1));&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/*CREATE MACRO VARIABLES FOR NAMES OF OUTPUT SPARKLINES&lt;BR /&gt;WITHIN SAME DO LOOP ITERATION*/&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;call symputx('name',"&amp;amp;data_set"||left(&amp;amp;i));&lt;BR /&gt;run;&lt;BR /&gt;filename odsout 'c:\temp\';&lt;BR /&gt;%put name=&amp;amp;name.;&lt;BR /&gt;/*USE SUMMARY VARIABLES AS INPUT FOR PROC SGPLOT*/&lt;BR /&gt;ods graphics / reset noborder width=1.95in height=.3in imagename="&amp;amp;name";&lt;BR /&gt;ODS LISTING GPATH = 'c:\temp';&lt;BR /&gt;proc sgplot data=spark noautolegend;&lt;BR /&gt; band x=x lower=ll upper=ul / fillattrs=(color=grayaa) ;&lt;BR /&gt; series x=x y=&amp;amp;var_name / lineattrs=(color=black thickness=2px) ;&lt;BR /&gt; series x=x y=z &lt;BR /&gt; / lineattrs=(color=black thickness=2px)&lt;BR /&gt; curvelabel="&amp;amp;lastone"&lt;BR /&gt; curvelabelattrs=(size=12pt color=red);&lt;BR /&gt; scatter x=x y=e / markerattrs=(symbol=circlefilled color=red ); *last point (red dot);&lt;BR /&gt; scatter x=x y=min / markerattrs=(symbol=circlefilled color=blue ); *minimum (blue dot);&lt;BR /&gt; scatter x=x y=max / markerattrs=(symbol=circlefilled color=green ); *maximum (green dot);&lt;BR /&gt; xaxis display=none;&lt;BR /&gt; yaxis display=none;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%sparkline(temp, y, 75TH, 25TH,YES);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data subjidn;&lt;/P&gt;
&lt;P&gt;do subjidn=1 to 25;&lt;BR /&gt; output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;ods pdf file="c:\temp\mypdf.pdf" notoc;&lt;BR /&gt;ods rtf file="c:\temp\myrtf.rtf";&lt;BR /&gt;proc report data=subjidn nowd ;&lt;BR /&gt;column subjidn sparkline ;&lt;BR /&gt;define subjidn / display;&lt;BR /&gt;define sparkline / computed format =$1. style(column)=[cellwidth=2in];&lt;BR /&gt;compute sparkline;&lt;BR /&gt; sparkline="";&lt;BR /&gt; call symputx('count',subjidn);&lt;BR /&gt; call define(_col_,'style','style=[preimage="c:\temp\temp&amp;amp;count.1.png"]'); &lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;BR /&gt;ods pdf close;&lt;BR /&gt;ods rtf close;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238383#M43797</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-08T21:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238392#M43802</link>
      <description>Hi--&lt;BR /&gt;You will find a simple win/loss sparkline that uses the Bissantz Spark Fonts in my paper Creating Complex Reports &lt;A href="http://www2.sas.com/proceedings/forum2008/173-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/173-2008.pdf&lt;/A&gt; on page 12.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Tue, 08 Dec 2015 22:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238392#M43802</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-12-08T22:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238397#M43805</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;
&lt;P&gt;Thanks for the reply! &amp;nbsp;I've read that paper already, but I couldnt find the Bissantz font anywhere. &amp;nbsp;Also, I'm very&amp;nbsp;interested in a "bar" sparkline.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cheers!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 22:35:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238397#M43805</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-08T22:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238400#M43808</link>
      <description>&lt;P&gt;Here's a mock-up of the report I am trying to build.&lt;/P&gt;
&lt;P&gt;Large teams could take up to 3 pages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12119iB6637FE04043567B/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="fake report.png" title="fake report.png" /&gt;</description>
      <pubDate>Tue, 08 Dec 2015 22:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238400#M43808</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-08T22:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238921#M43920</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;
&lt;P&gt;Thanks for replying. &amp;nbsp;I've been wondering why &amp;nbsp;in that paper you say that these reports are typically output to RTF instead of PDF or HTML?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it because you do post-processing before converting to PDF? Because my clients typically want a PDF, not a word file.&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2015 15:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238921#M43920</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-11T15:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238930#M43922</link>
      <description>Well, the Bissantz SparkFonts were initially a font plug-in for Word. And at the time I wrote the paper, most of my sparkline examples were documents that were being edited after creation. That is a 7 year old paper -- and I would expect that HTML and PDF are probably just as popular. &lt;BR /&gt;&lt;BR /&gt;Also, at the time I wrote the paper, ODS GRAPHICS was not production and the SG Procedures did not exist. For example, this blog shows sparklines using ODS GRAPHICS: &lt;A href="http://blogs.sas.com/content/graphicallyspeaking/2012/07/04/spark-lines-made-easy/" target="_blank"&gt;http://blogs.sas.com/content/graphicallyspeaking/2012/07/04/spark-lines-made-easy/&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;and look on page 13 of this paper. If you made your bar chart very small and the right size, then you could insert it into your PROC REPORT output as shown here: &lt;A href="http://www.lexjansen.com/nesug/nesug13/122_Final_Paper.pdf" target="_blank"&gt;http://www.lexjansen.com/nesug/nesug13/122_Final_Paper.pdf&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Fri, 11 Dec 2015 16:21:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/238930#M43922</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2015-12-11T16:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report, sparklines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/239000#M43931</link>
      <description>That last report (and its code) is exactly what I was looking for!  Thanks for pointing me to it, I would never have made it until the part where it mentions sparklines..&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Dec 2015 21:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Report-sparklines/m-p/239000#M43931</guid>
      <dc:creator>morglum</dc:creator>
      <dc:date>2015-12-11T21:17:38Z</dc:date>
    </item>
  </channel>
</rss>

