<?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: Adding column/row titles &amp;amp; graph colors via PROC GREPLAY in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Adding-column-row-titles-amp-graph-colors-via-PROC-GREPLAY/m-p/665123#M198809</link>
    <description>&lt;P&gt;The techniques in this paper&amp;nbsp;&lt;A href="https://www.lexjansen.com/phuse/2006/cc/CC07.pdf" target="_blank"&gt;https://www.lexjansen.com/phuse/2006/cc/CC07.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;might work for you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2020 19:08:08 GMT</pubDate>
    <dc:creator>AhmedAl_Attar</dc:creator>
    <dc:date>2020-06-25T19:08:08Z</dc:date>
    <item>
      <title>Adding column/row titles &amp; graph colors via PROC GREPLAY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-column-row-titles-amp-graph-colors-via-PROC-GREPLAY/m-p/665113#M198802</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have the following data on quarterly sales by type (called WAM, SME and FS) by source of change: lost, new and top 10 gainers.&amp;nbsp; Using PROC GREPLAY I can place all the graphs on 1 slide using this code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data trends;
length type $14.;
infile datalines missover;
input type $ period $ sme_adv fs_adv wam_adv;
datalines;
lost CY17Q1 -490 -39 -2
lost CY17Q2 -478 -38 -3
lost CY17Q3 -505 -78 -2
lost CY17Q4 -491 -44 -43
lost CY18Q1 -491 -44 -1
lost CY18Q2 -485 -46 -10
lost CY18Q3 -460 -181 -13
lost CY18Q4 -442 -387 -12
lost CY19Q1 -407 -468 -21
lost CY19Q2 -433 -178 -5
lost CY19Q3 -447 -181 -5
lost CY19Q4 -421 -298 -2
lost CY20Q1 -395 -286 -3
lost CY20Q2 -410 -259 -19
lost CY20Q3 -411 -359 -25
lost CY20Q4 -537 -427 -10
new CY17Q1 19 206 26
new CY17Q2 428 264 2
new CY17Q3 397 496 1
new CY17Q4 460 888 2
new CY18Q1 492 1047 100
new CY18Q2 531 522 12
new CY18Q3 568 490 50
new CY18Q4 414 810 1
new CY19Q1 427 685 1
new CY19Q2 468 750 8
new CY19Q3 439 687 7
new CY19Q4 581 404 52
new CY20Q1 961 246 97
new CY20Q2 960 130 110
new CY20Q3 1136 246 110
new CY20Q4 831 289 150
top_10_gainers CY17Q1 60 345 1038
top_10_gainers CY17Q2 35 254 1043
top_10_gainers CY17Q3 80 517 579
top_10_gainers CY17Q4 55 436 267
top_10_gainers CY18Q1 110 377 190
top_10_gainers CY18Q2 122 433 993
top_10_gainers CY18Q3 150 521 682
top_10_gainers CY18Q4 100 420 1320
top_10_gainers CY19Q1 90 336 1518
top_10_gainers CY19Q2 75 364 1189
top_10_gainers CY19Q3 50 602 560
top_10_gainers CY19Q4 55 377 1969
top_10_gainers CY20Q1 80 636 3655
top_10_gainers CY20Q2 92 1431 3114
top_10_gainers CY20Q3 111 2359 8896
top_10_gainers CY20Q4 150 1859 4191
;

%macro mylist(name,type,measure);
ODS tagsets.sasreport13(ID=EGSR) gtitle; * Puts the title inside the graph (https://communities.sas.com/t5/SAS-Enterprise-Guide/Locating-titles-inside-of-chart-area-in-proc-sgplot/td-p/229762?nobounce) see Feb 10, 2017 note from SAS;
ods graphics / reset=all imagename=&amp;amp;name. height=3.75in width=6.5in;

title4 FONT='Arial Narrow/Bold' HEIGHT=20 PT COLOR=Black ;
PROC SGPLOT DATA = trends noborder noautolegend nowall noborder pad=0;
where type=&amp;amp;type.;
SERIES X = period Y = &amp;amp;measure. / LINEATTRS = (color=blue THICKNESS = 5);
XAXIS DISPLAY=(NOLABEL) GRID valueattrs=(color=black size=12pt) LABELATTRS=(color=black size=12pt weight=bold) fitpolicy=thin;
YAXIS DISPLAY=(NOLABEL) GRID valueattrs=(color=blue size=12pt weight=bold) LABELATTRS=(color=blue size=12pt weight=bold);
RUN; 
title4;
%mend;
%mylist('sme_adv_lost','lost',sme_adv);
%mylist('sme_adv_new','new',sme_adv);
%mylist('sme_adv_top10_gainers','top_10_gainers',sme_adv);
%mylist('wam_adv_lost','lost',WAM_adv);
%mylist('wam_adv_new','new',WAM_adv);
%mylist('wam_adv_top10_gainers','top_10_gainers',WAM_adv);


******End of data generation********************;
* Create graphical catalogue to place multiple charts on one page;
%macro delcat(catname);

%if %sysfunc(cexist(&amp;amp;catname)) 
%then %do; 
proc greplay nofs igout=&amp;amp;catname; 
delete _all_; 
run;
quit; 
%end; 
%mend delcat; 
%delcat(work.gseg)

* Create graphical catalogue to place multiple charts on one page; 
proc greplay tc=work.tmplt nofs; 
tdef PK1 
1 / llx = 0 lly = 51 ulx = 0 uly = 100 lrx = 33 lry = 51 urx = 33 ury = 100 
2 / llx = 34 lly = 51 ulx = 34 uly = 100 lrx = 66 lry = 51 urx = 66 ury = 100 
3 / llx = 67 lly = 51 ulx = 67 uly = 100 lrx = 100 lry = 51 urx = 100 ury = 100 
4 / llx = 0 lly = 0 ulx = 0 uly = 50 lrx = 33 lry = 0 urx = 33 ury = 50 
5 / llx = 34 lly = 0 ulx = 34 uly = 50 lrx = 66 lry = 0 urx = 66 ury = 50 
6 / llx = 67 lly = 0 ulx = 67 uly = 50 lrx = 100 lry = 0 urx = 100 ury = 50 ;
run; 
quit;

ods _all_ close; 
ods listing; 
options orientation=landscape topmargin=.25IN bottommargin=.25IN 
leftmargin=.25IN rightmargin=.25IN ; 
goptions reset=all device=PNG300 nodisplay hsize=6.5in vsize=3.75in;


%let workdir=%trim(%sysfunc(pathname(work)));
ods listing gpath="&amp;amp;workdir" image_dpi=100;

goptions reset=all device=PNG300 nodisplay vsize=3.75in hsize=6.5in imagestyle=fit;

goptions iback="&amp;amp;workdir.\sme_adv_lost.png"; 
proc gslide name='sgplot1'; run; quit;

goptions iback="&amp;amp;workdir.\sme_adv_new.png"; 
proc gslide name='sgplot2'; run; quit;

goptions iback="&amp;amp;workdir.\sme_adv_top10_gainers.png"; 
proc gslide name='sgplot3'; run; quit;

goptions iback="&amp;amp;workdir.\wam_adv_lost.png"; 
proc gslide name='sgplot4'; run; quit;

goptions iback="&amp;amp;workdir.\wam_adv_new.png"; 
proc gslide name='sgplot5'; run; quit;

goptions iback="&amp;amp;workdir.\wam_adv_top10_gainers.png"; 
proc gslide name='sgplot6'; run; quit;

goptions reset=all device=png300 hsize=8in vsize=5.5in; 
ods _all_ close; 
ODS rtf file='C:\user\SAS_Customer_Data\base_analysis\sales_segment.rtf' image_dpi=300 ; 

* Place first 4 charts onto one page; 
proc greplay igout=work.gseg
tc=work.tmplt nofs; 
template PK1; 
treplay 1:1 2:2 3:3 4:4 5:5 6:6 ; 
run;
quit; 
ods _all_ close; 
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which gives me the following image:&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="greplay_no_titles_no_colors.PNG" style="width: 705px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46668iA70DF74750E5FA36/image-dimensions/705x486?v=v2" width="705" height="486" role="button" title="greplay_no_titles_no_colors.PNG" alt="greplay_no_titles_no_colors.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I need to enhance this group of graphs with the following:&lt;/P&gt;&lt;P&gt;1. Main title&lt;/P&gt;&lt;P&gt;2. Row and column titles&lt;/P&gt;&lt;P&gt;3. Color each graph using a stop light analogy.&amp;nbsp; Using the latest reported quarter I want the entire graph to be colored in the following way based on CY20Q4 values vs CY19Q4 values (which are YoY changes):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if CY20Q4 &amp;gt; CY19Q4 then color = green&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if CY20Q4 &amp;lt; CY19Q4 then color = red&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if CY20Q4 = CY19Q4 then color = yellow&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the end graph looks like this:&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="after.PNG" style="width: 930px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46670i33FD0E7AD85B6A95/image-size/large?v=v2&amp;amp;px=999" role="button" title="after.PNG" alt="after.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I do this?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 18:12:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-column-row-titles-amp-graph-colors-via-PROC-GREPLAY/m-p/665113#M198802</guid>
      <dc:creator>Jack1</dc:creator>
      <dc:date>2020-06-25T18:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding column/row titles &amp; graph colors via PROC GREPLAY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Adding-column-row-titles-amp-graph-colors-via-PROC-GREPLAY/m-p/665123#M198809</link>
      <description>&lt;P&gt;The techniques in this paper&amp;nbsp;&lt;A href="https://www.lexjansen.com/phuse/2006/cc/CC07.pdf" target="_blank"&gt;https://www.lexjansen.com/phuse/2006/cc/CC07.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;might work for you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 19:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Adding-column-row-titles-amp-graph-colors-via-PROC-GREPLAY/m-p/665123#M198809</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2020-06-25T19:08:08Z</dc:date>
    </item>
  </channel>
</rss>

