<?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 Univariate - Histogram options - Specify Color bar &amp;amp; Title/Description in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723696#M21107</link>
    <description>Yes, any graphics related questions are best posted there.</description>
    <pubDate>Thu, 04 Mar 2021 22:23:00 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-03-04T22:23:00Z</dc:date>
    <item>
      <title>Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723635#M21104</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am using the following code to create Histograms that I will ultimately include in a presentation package. I need to format the titles and color bars so that it matches the rest of the presentation template. My 2 needs are :&lt;/P&gt;
&lt;P&gt;- What is the code to specify the color that is filled in the histogram bar?&lt;/P&gt;
&lt;P&gt;- What is the code to display the BY variables in the Plot Description? Currently the histogram description is "Distribution of PnL". I want to be able to say "Distribution of PnL - &amp;lt;&lt;EM&gt;Symbol&lt;/EM&gt;&amp;gt;_&amp;lt;&lt;EM&gt;RiskProfile&lt;/EM&gt;&amp;gt;"&lt;/P&gt;
&lt;P&gt;Any suggestions would be greatly appreciated. If this question should be posted in Graphics community, please let me know.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods select Histogram;
proc univariate data=Mstr_rule4a_analysis noprint;
by symbol riskprofile;
var PnL;
histogram/barlabel=count ;
where win_loss ne 'FEE' and year ge 2015 ;
inset n mean std="Std Dev" / pos = ne format = 5.2;
title 'IB One-5yrs-Histogram PnL';
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Mar 2021 18:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723635#M21104</guid>
      <dc:creator>IChatterji</dc:creator>
      <dc:date>2021-03-05T18:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Univariate - Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723648#M21105</link>
      <description>You can control it somewhat using the different style templates but PROC UNIVARIATE doesn't offer much customization options. &lt;BR /&gt;&lt;BR /&gt;If you're looking for a fully customized graph, I would highly suggest using SGPLOT histogram code instead.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2017/04/30/getting-started-with-sgplot-histograms/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2017/04/30/getting-started-with-sgplot-histograms/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You would use FILL/FILLATTRS option on the HISTOGRAM statement to control the colours.&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=n17xrpcduau1f8n1c1nhe477pv18.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=n17xrpcduau1f8n1c1nhe477pv18.htm&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723648#M21105</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-04T21:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Univariate - Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723683#M21106</link>
      <description>&lt;P&gt;Thank you. I will try my hand at SGPLOT. Are questions on SGPLOT best directed to the Graphics community?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723683#M21106</guid>
      <dc:creator>IChatterji</dc:creator>
      <dc:date>2021-03-04T21:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Univariate - Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723696#M21107</link>
      <description>Yes, any graphics related questions are best posted there.</description>
      <pubDate>Thu, 04 Mar 2021 22:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723696#M21107</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-04T22:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Univariate - Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723945#M21108</link>
      <description>&lt;P&gt;For the title, use the ODSTITLE= option in conjunction with the #BYVAL keyword. If you aren't familiar with the #BYVAL keyword, see &lt;A href="https://blogs.sas.com/content/iml/2021/02/22/byvar-byval-keywords-sas-titles.html" target="_self"&gt;"How to use the #BYVAR and #BYVAL keywords."&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options nobyline;

proc univariate ...;
ods select Histogram;
by symbol riskprofile;
var PnL;
histogram PnL / odstitle="Distribution of PnL - #ByVal1._#ByVal2";
...
run;

options byline;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even if you switch to PROC SGPLOT (which I agree is a good idea), you can also use the #BYVAL keyword to control the TITLE statement used for your PROC SGPLOT graphs.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 18:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723945#M21108</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-03-05T18:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Univariate - Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723968#M21109</link>
      <description>&lt;P&gt;Thank you Rick. The #ByVal&amp;lt;n&amp;gt; option works very well, I am a bit embarrassed that it was not known to me as this was available in SAS since 1998! I am attaching below my final code in case any reader wants to view the before/after code change.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options byline;
ods select Histogram;
proc univariate data=Mstr_rule4a_analysis noprint;
by symbol riskprofile;
var PnL;
histogram/barlabel=count odstitle="Distribution of PnL - #ByVal1._#ByVal2";
where win_loss ne 'FEE' and year ge 2015 ;
inset n mean std="Std Dev" / pos = ne format = 5.2;
title 'IB One-5yrs-Histogram PnL';
run;
title;
options nobyline;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Do you by any chance have a suggestion for how to change the colors in the histogram bars without going to SGPLOT?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 19:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723968#M21109</guid>
      <dc:creator>IChatterji</dc:creator>
      <dc:date>2021-03-05T19:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Univariate - Histogram options - Specify Color bar &amp; Title/Description</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723977#M21110</link>
      <description>&lt;P&gt;The colors in SAS graphs are determined by the current ODS style.&amp;nbsp; You can create a new style and specify the color that is used to fill bars (and other graph attributes). There is &lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_odsgraph_sect048.htm&amp;amp;locale=en" target="_self"&gt;a whole chapter in the SAS/STAT documentation about how to understand and modify ODS styles&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally, I think it will be easier for you to use SGPLOT. Here is an example so you can see how it is done:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.cars(where=(type in ('Sedan' 'Wagon' 'SUV'))) out=cars;
by origin type;
run;

options nobyline;

title "Distribution of MPG City - #ByVal1._#ByVal2";
proc sgplot data=cars;
by origin type;
histogram MPG_City / fillattrs=(color=VeryLightYellow); /* or color=CXFAFAA0 */
run;

options byline;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Mar 2021 19:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Histogram-options-Specify-Color-bar-amp-Title-Description/m-p/723977#M21110</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-03-05T19:29:32Z</dc:date>
    </item>
  </channel>
</rss>

