<?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: Preloadfmt equivalent in SAS VA (or other solution to keep bars same width) in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/769992#M15329</link>
    <description>&lt;P&gt;Thank you for your answer. I realize that solution will work for most reports, but unfortunately not in my case.&lt;/P&gt;
&lt;P&gt;What will not work for us is: &lt;EM&gt;"&lt;FONT color="#808080"&gt;The completeness has to be given for any filter drill-down that you grant the users&lt;/FONT&gt;".&lt;/EM&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Having to keeping the "completeness-dataset" up to date with the filter parameters is not ideal out of a maintenance point of view.&lt;/LI&gt;
&lt;LI&gt;The&amp;nbsp;"completeness-dataset" will get very large. There will be around one thousand departments using the report. Each department see only their own data. There will be a date slider where users can select any date interval from the last five years. That makes 1000 * 1,6 million unique combinations. Add to that 5 or 6 other subsetting buttons with each 3 or 4 options...&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;That is what I had in mind when i wrote "&lt;FONT color="#808080"&gt;&lt;EM&gt;I have read&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Visual-Analytics/Missing-categories-in-bar-chart/td-p/357805" target="_blank" rel="noopener"&gt;Solved: Missing categories in bar chart - SAS Support Communities&lt;/A&gt;&amp;nbsp;but I'm kind of hoping there is a better solution today. Inputing zero-data is not a good solution for a report where users can do their own subsetting.&lt;/EM&gt;&lt;/FONT&gt;". I realize I could have been (a lot) more specific.&lt;/P&gt;</description>
    <pubDate>Thu, 23 Sep 2021 17:35:38 GMT</pubDate>
    <dc:creator>FredrikHansson</dc:creator>
    <dc:date>2021-09-23T17:35:38Z</dc:date>
    <item>
      <title>Preloadfmt equivalent in SAS VA (or other solution to keep bars same width)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/764446#M15220</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We're about to rebuild a bunch of sgplot barcharts in VA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For two reasons it's important for us to always show all the categories(bars) even if the report user have made a subset that do not contain all categories.&lt;/P&gt;
&lt;P&gt;* We want it to be obvious for the user to see what categories that get a zero-bar.&lt;/P&gt;
&lt;P&gt;* We would like the bars to retain the same width when users view a subset of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll first describe how we solve the problem today:&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First example of not-desired result. One of the categories is not displayed in the graf.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* First we create a format for the category	;
proc format;
	value age_group
		LOW - 29 = '0-29'
		30 - 39 = '30-39'
		40 - 49 = '40-49'
		50 - 59 = '50-59'
		60 - 69 = '60-69'
		70 - 79 = '70-79'
		80 - 89 = '80-89'
		90 - HIGH = '90-';
quit;

ods graphics / height=250px;

title "One group is missing (0-29)";
PROC SGPLOT DATA=sashelp.heart ;
	format AgeCHDdiag age_group.;
	HBAR AgeCHDdiag / STAT=FREQ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FredrikHansson_0-1630067946153.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63087i47AA7BC3D75AED4C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FredrikHansson_0-1630067946153.png" alt="FredrikHansson_0-1630067946153.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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second example of not-desired result. This time the user have done some subsetting. Bars get super wide.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.heart_subset;
	set sashelp.heart;
	where AgeCHDdiag LT 60;
run;
title "Many groups are missing and bars get terribly wide";
PROC SGPLOT DATA=work.heart_subset;
	format AgeCHDdiag age_group.;
	HBAR AgeCHDdiag / STAT=FREQ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FredrikHansson_1-1630068244466.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63088i38B8283CF4565165/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FredrikHansson_1-1630068244466.png" alt="FredrikHansson_1-1630068244466.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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using proc summary with preloadfmt and completeTypes solves our problem.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=work.heart_subset completeTypes;
	format AgeCHDdiag age_group.;
	class AgeCHDdiag / preloadfmt ;
	types AgeCHDdiag;
	output out=work.heart_summary;
	label _FREQ_ = "Frequency";
run;

title "All groups are displayed. Bars will always have the same width.";
PROC SGPLOT DATA=work.heart_summary;
	HBARPARM CATEGORY=AgeCHDdiag RESPONSE=_FREQ_;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FredrikHansson_2-1630068301296.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63089i96B873F96536219E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FredrikHansson_2-1630068301296.png" alt="FredrikHansson_2-1630068301296.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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So back to the question. Is there a way to achieve the same result as in the last picture in SAS VA? I have promoted VA internally quite a bit. It will be hard for me to explain to the UX-designers that this can't be done in our shiny new reporting-software. Please help me. &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: I have read&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Visual-Analytics/Missing-categories-in-bar-chart/td-p/357805" target="_blank"&gt;Solved: Missing categories in bar chart - SAS Support Communities&lt;/A&gt;&amp;nbsp;but I'm kind of hoping there is a better solution today. Inputing zero-data is not a good solution for a report where users can do their own subsetting.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 12:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/764446#M15220</guid>
      <dc:creator>FredrikHansson</dc:creator>
      <dc:date>2021-08-27T12:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Preloadfmt equivalent in SAS VA (or other solution to keep bars same width)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/769137#M15314</link>
      <description>&lt;P&gt;Yes, that's possible. &lt;BR /&gt;You'll need the prior data step to create completetypes. The completeness has to be given for any filter drill-down that you grant the users.&lt;BR /&gt;It can be achieved with user defined formats. Probably you'll need admin rights to promote therm.&lt;BR /&gt;Once you have the udf all set, you promote the table in sas studio assigning to your age this newly created format.&lt;BR /&gt;When opening in VA it gets displayed as wished.&lt;/P&gt;
&lt;P&gt;Furthermore apply custom sort to this UDF inside VA. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cas mysession dropfmtlib fmtlibname=myFmtLib  /* 2 */
fmtsearchremove;

proc casutil;
deletesource casdata="myFmtLib.sashdat" incaslib="public";
run;

proc format library=work.formats casfmtlib="myFmtLib";
	value age_group
		LOW - 29 = '0-29'
		30 - 39 = '30-39'
		40 - 49 = '40-49'
		50 - 59 = '50-59'
		60 - 69 = '60-69'
		70 - 79 = '70-79'
		80 - 89 = '80-89'
		90 - HIGH = '90-';
quit;

cas mysession savefmtlib fmtlibname=myFmtLib         /* 5 */
   table="myFmtLib.sashdat" caslib=PUBLIC replace;

cas mysession addfmtlib fmtlibname=myFmtLib     /* 2 */
   table="myFmtLib.sashdat" caslib=PUBLIC replacefmtlib;

cas mysession promotefmtlib fmtlibname=myFmtLib REPLACE;

/* go to manage environment and promote he format assuming suoer user role  */

data work.heart_subset;
	set sashelp.heart;
	where AgeCHDdiag LT 60;
frek_dummy=1;
run;

data numbers;
do AgeCHDdiag=25 to 95 by 10;
output;
end;
run;

proc sql;
create table dummy as 
select a.*, b.AgeCHDdiag, 0 as frek_dummy
from work.heart_subset(drop=AgeCHDdiag frek_dummy) a cross join numbers b;
quit;

data public.heart_subset_dummy(promote=yes);
set work.heart_subset(in=a) dummy;
format _AgeCHDdiag age_group_copy.;
_AgeCHDdiag=AgeCHDdiag;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a4.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63900iB03809C060C72742/image-size/large?v=v2&amp;amp;px=999" role="button" title="a4.png" alt="a4.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a3.png" style="width: 724px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63901iD09D83DFB871690C/image-size/large?v=v2&amp;amp;px=999" role="button" title="a3.png" alt="a3.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a2.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63902iBF70A2EADF8C79D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="a2.png" alt="a2.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63903i6809C9C5818F0F1A/image-size/large?v=v2&amp;amp;px=999" role="button" title="a1.png" alt="a1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 15:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/769137#M15314</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2021-09-22T15:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Preloadfmt equivalent in SAS VA (or other solution to keep bars same width)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/769992#M15329</link>
      <description>&lt;P&gt;Thank you for your answer. I realize that solution will work for most reports, but unfortunately not in my case.&lt;/P&gt;
&lt;P&gt;What will not work for us is: &lt;EM&gt;"&lt;FONT color="#808080"&gt;The completeness has to be given for any filter drill-down that you grant the users&lt;/FONT&gt;".&lt;/EM&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Having to keeping the "completeness-dataset" up to date with the filter parameters is not ideal out of a maintenance point of view.&lt;/LI&gt;
&lt;LI&gt;The&amp;nbsp;"completeness-dataset" will get very large. There will be around one thousand departments using the report. Each department see only their own data. There will be a date slider where users can select any date interval from the last five years. That makes 1000 * 1,6 million unique combinations. Add to that 5 or 6 other subsetting buttons with each 3 or 4 options...&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;That is what I had in mind when i wrote "&lt;FONT color="#808080"&gt;&lt;EM&gt;I have read&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Visual-Analytics/Missing-categories-in-bar-chart/td-p/357805" target="_blank" rel="noopener"&gt;Solved: Missing categories in bar chart - SAS Support Communities&lt;/A&gt;&amp;nbsp;but I'm kind of hoping there is a better solution today. Inputing zero-data is not a good solution for a report where users can do their own subsetting.&lt;/EM&gt;&lt;/FONT&gt;". I realize I could have been (a lot) more specific.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 17:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/769992#M15329</guid>
      <dc:creator>FredrikHansson</dc:creator>
      <dc:date>2021-09-23T17:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Preloadfmt equivalent in SAS VA (or other solution to keep bars same width)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/770030#M15330</link>
      <description>There's another solution. You can use the data driven content which calls a job that executes sas code and outputs the graph back to the report.&lt;BR /&gt;Just yesterday 2 real experts in this matter solved me this particular challenge.</description>
      <pubDate>Thu, 23 Sep 2021 19:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/770030#M15330</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2021-09-23T19:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Preloadfmt equivalent in SAS VA (or other solution to keep bars same width)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/770033#M15331</link>
      <description>I have an idea. Probably you can force all categories to appear independently of the user's choices. This should work using an advanced filter with the object. &lt;BR /&gt;And you could only append 7 rows to the original data set each representing one age group. You could assign a filter flag to these few observations. And use this in an OR clause in the advanced filter. Give it a try.</description>
      <pubDate>Thu, 23 Sep 2021 20:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/770033#M15331</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2021-09-23T20:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Preloadfmt equivalent in SAS VA (or other solution to keep bars same width)</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/772141#M15381</link>
      <description>Thank you. I'll give that a try as soon as we get VA installed.</description>
      <pubDate>Tue, 05 Oct 2021 12:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Preloadfmt-equivalent-in-SAS-VA-or-other-solution-to-keep-bars/m-p/772141#M15381</guid>
      <dc:creator>FredrikHansson</dc:creator>
      <dc:date>2021-10-05T12:42:49Z</dc:date>
    </item>
  </channel>
</rss>

