<?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: How to set the order of alpha categories on group and subgroup levels in a bar chart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582980#M18744</link>
    <description>&lt;P&gt;My data set looks like this :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample_slide4_usage;
infile datalines delimiter= ',';
input
usage_text : $60. source : $45. my_order : $40. GROUP_NUMBER : $10.
COUNT PERCENT comment_text : $80. Service_Type1 Service_Type2 Service_Type3 ;
/* insert some blanks and '\', to use as the 'split' character in the axis */
usage_text='a0'x||'\'||'a0'x||'\'||trim(left(usage_text));
datalines ;
PService Type 1 has a long description,Benchmark,1-Service Type 1,BENCH,3334399,31.468822649, members had this type of service,1,0,0
PService Type 1 has a long description,Your Members' Utilization,1-Service Type 1,0009999,3506,32.705223881, members had this type of service,1,0,0
AService Type 2 medium,Benchmark,2-Service Type 2,BENCH,193769,1.828720047, members had this type of service,0,1,0
AService Type 2 medium,Your Members' Utilization,2-Service Type 2,0009999,247,2.3041044776, members had this type of service,0,1,0
MixService Type 3 medium,Benchmark,3-Service Type 3,BENCH,3150839,29.736451363, members had this type of service,0,0,1
MixService Type 3 medium,Your Members' Utilization,3-Service Type 3,0009999,3598,33.563432836, members had this type of service,0,0,1
NType 4 short,Benchmark,4-Service Type 4,BENCH,3916874,36.966005941, members had this type of service,0,0,0
NType 4 short,Your Members' Utilization,4-Service Type 4,0009999,3369,31.427238806, members had this type of service,0,0,0
;
run;

proc sort data= sample_slide4_usage out=  sample_slide4_usage;
by  my_order source;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want the report to present in this order but use the Usage_Text as the printed category label to the left of the actual graph.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data my_anno; 
set  sample_slide4_usage;
length function $8 text $100;
/* use data VALUE oriented numbering systems - this will allow percentages to hang on the end of the bar initialize to '2' for both */
xsys='2'; ysys='2';
/* HSYS = 3 MEANS USE PERCENTAGE OF GRAPHICS OUTPUT AREA FOR HEIGHT - I don't think this is being used as there is no size variable */
hsys='3'; when='a';
/* set the initial function and color default  - can be changed later in the step . */
function='label'; color='gray33';

/* Annotate the values at the ends of the bars  -  Set the first bar percentage */
/* this will also print the percentage for the second bar when it comes around*/
/* set the group variable to match grouping on the gchart */
/* This value prints as part of the gaxis  (axis2 definition ) print using the Axis. 
/* There may be another way to print this label that allows me to substitute a different label to the coordinate value */
/* The two slashes in front cause it to skip down and line up in the middle of the two bars */
group=my_order;
yc=source;
x=PERCENT;
/* put the label just at the end of the chart */
function='label'; position='&amp;gt;';
/* build the text label with a leading space */
text='a0'x||put(percent/100,percent7.2);
output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I created the formats to change from my_order to usage_text.&amp;nbsp; And tried to run the report.&amp;nbsp; It replaces the my_order text with the usage_text data but then re-sorts the data on the graph to match the new alpha order for the new formatted values.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;                                                                                                                            
   value $usage_text   
'1-Service Type 1'='&amp;nbsp;\&amp;nbsp;\PService Type 1 has a long description' 
'2-Service Type 2'='&amp;nbsp;\&amp;nbsp;\AService Type 2 medium' 
'3-Service Type 3'='&amp;nbsp;\&amp;nbsp;\MixService Type 3 medium' 
'4-Service Type 4'='&amp;nbsp;\&amp;nbsp;\NType 4 short' ; 
run; 
 proc format;                                                                                                                            
   value $my_order   
'&amp;nbsp;\&amp;nbsp;\PService Type 1 has a long description'= '1-Service Type 1' 
'&amp;nbsp;\&amp;nbsp;\AService Type 2 medium'= '2-Service Type 2'
'&amp;nbsp;\&amp;nbsp;\MixService Type 3 medium'= '3-Service Type 3'
'&amp;nbsp;\&amp;nbsp;\NType 4 short'= '4-Service Type 4'; 
run;

goptions device=png xpixels=800 ypixels=500;

goptions gunit=pct htext=9pt;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&amp;amp;name..htm" style=htmlblue;

axis1 label=none value=none;
axis2 label=none value=(justify=right font='Calibri/bold' h=12pt) split='\' offset=(3,2);
axis3 label=none value=none major=none minor=none style=0 offset=(0,5);

legend1 label=none noframe across=1 position=(top right outside) mode=share value=("Benchmark" "Your Members' Utilization")
shape=bar(.1in,.1in) offset=(-5,8);

pattern1 v=s c=cx48af35;
pattern2 v=s c=gray33;

title1 h=16pt font='Calibri/bold' ls=1.5
box=1 bcolor=cx48af35 color=white 'Member Utilization at a Glance';

proc gchart data= sample_slide4_usage anno=my_anno;
hbar source /  type=sum sumvar=percent nostats
midpoints= "Benchmark" "Your Members' Utilization"
maxis=axis1 
/* commenting this next line should drop the axis label for Usage Type forces the default axis labels */
gaxis=axis2 
raxis=axis3
/*noaxis*/
noframe
/* change group to my_order - originally was usage_text -  modify the order of graphs */
space=0 gspace=4 group=my_order  /* or my_order */
legend=legend1 coutline=same subgroup=source
des='' name="&amp;amp;name";
format my_order $usage_text. ;
run;
/*midpoints =( "&amp;nbsp;\&amp;nbsp;\PService Type 1 has a long description" &amp;nbsp;"&amp;nbsp;\&amp;nbsp;\AService Type 2 medium" "&amp;nbsp;\&amp;nbsp;\MixService Type 3 medium" "&amp;nbsp;\&amp;nbsp;\NType 4 short")*/

quit;
ODS HTML CLOSE;
ODS LISTING;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="This is sorted alphabetically and I want it sorted in the order by Type number" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31931i8EC4F8E8F15BF056/image-size/large?v=v2&amp;amp;px=999" role="button" title="testpn48.png" alt="This is sorted alphabetically and I want it sorted in the order by Type number" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This is sorted alphabetically and I want it sorted in the order by Type number&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="This is how I want is sorted but with the text description being usage text." style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31932i0F82D6B0DC955672/image-size/large?v=v2&amp;amp;px=999" role="button" title="testpn41.png" alt="This is how I want is sorted but with the text description being usage text." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This is how I want is sorted but with the text description being usage text.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 20:04:16 GMT</pubDate>
    <dc:creator>qaguy1982</dc:creator>
    <dc:date>2019-08-21T20:04:16Z</dc:date>
    <item>
      <title>How to set the order of alpha categories on group and subgroup levels in a bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582889#M18742</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Graphics-Programming/GCHART-graphics-area-for-Horizontal-bar-charts-changes-based/m-p/582084#M18708" target="_self"&gt;https://communities.sas.com/t5/Graphics-Programming/GCHART-graphics-area-for-Horizontal-bar-charts-changes-based/m-p/582084#M18708&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I submitted the above question and received an answer that has been mostly workable for me.&amp;nbsp; I have a followup.&lt;/P&gt;&lt;P&gt;When I reverted back to my original data, the categories for the four pairs of bar charts sort alphabetically into a different order.&lt;/P&gt;&lt;P&gt;My customer wants report categories like :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Preventive Services (including the two detail bar charts for this category and so on for the remaining categories.)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Benchmark Usage percentage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;My Client usage percentage&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Acute/Emergency Services&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Benchmark Usage percentage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;My Client usage percentage&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mix of Services&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Benchmark Usage percentage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;My Client usage percentage&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No Services&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Benchmark Usage percentage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;My Client usage percentage&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will note that these are not in alpha order as the original data set&amp;nbsp; (Service Type 1, Service Type 2... Service Type 4)&lt;/P&gt;&lt;P&gt;Is there a way to control the order of both the primary group and the subgroups?&lt;/P&gt;&lt;P&gt;If I try to control the groups using Midpoints, I get stacked bars for the two sets of details.&lt;/P&gt;&lt;P&gt;I don't seem to be able to set midpoints for each level&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just changed the original data set to change the group titles but now they sort in the order of Acute, Mix, No and Preventive which is like Service types 2,3,4,1.&amp;nbsp; I want to be able to sort them without forcing a number of letter ordering on the display.&lt;/P&gt;&lt;P&gt;I also tried using PROC Format to change the data but that just replaces the original data with the new format and then sorts by the new format.&amp;nbsp; What I want is the order of the categories to be 1,2,3,4 but display the text descriptions on my chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for any advice.&amp;nbsp; This has been a great forum.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 16:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582889#M18742</guid>
      <dc:creator>qaguy1982</dc:creator>
      <dc:date>2019-08-21T16:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the order of alpha categories on group and subgroup levels in a bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582898#M18743</link>
      <description>PROC FORMAT is the right approach, can you show how you tried that option? Did you specify an ORDER option on one of the statements?</description>
      <pubDate>Wed, 21 Aug 2019 16:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582898#M18743</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T16:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the order of alpha categories on group and subgroup levels in a bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582980#M18744</link>
      <description>&lt;P&gt;My data set looks like this :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample_slide4_usage;
infile datalines delimiter= ',';
input
usage_text : $60. source : $45. my_order : $40. GROUP_NUMBER : $10.
COUNT PERCENT comment_text : $80. Service_Type1 Service_Type2 Service_Type3 ;
/* insert some blanks and '\', to use as the 'split' character in the axis */
usage_text='a0'x||'\'||'a0'x||'\'||trim(left(usage_text));
datalines ;
PService Type 1 has a long description,Benchmark,1-Service Type 1,BENCH,3334399,31.468822649, members had this type of service,1,0,0
PService Type 1 has a long description,Your Members' Utilization,1-Service Type 1,0009999,3506,32.705223881, members had this type of service,1,0,0
AService Type 2 medium,Benchmark,2-Service Type 2,BENCH,193769,1.828720047, members had this type of service,0,1,0
AService Type 2 medium,Your Members' Utilization,2-Service Type 2,0009999,247,2.3041044776, members had this type of service,0,1,0
MixService Type 3 medium,Benchmark,3-Service Type 3,BENCH,3150839,29.736451363, members had this type of service,0,0,1
MixService Type 3 medium,Your Members' Utilization,3-Service Type 3,0009999,3598,33.563432836, members had this type of service,0,0,1
NType 4 short,Benchmark,4-Service Type 4,BENCH,3916874,36.966005941, members had this type of service,0,0,0
NType 4 short,Your Members' Utilization,4-Service Type 4,0009999,3369,31.427238806, members had this type of service,0,0,0
;
run;

proc sort data= sample_slide4_usage out=  sample_slide4_usage;
by  my_order source;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want the report to present in this order but use the Usage_Text as the printed category label to the left of the actual graph.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data my_anno; 
set  sample_slide4_usage;
length function $8 text $100;
/* use data VALUE oriented numbering systems - this will allow percentages to hang on the end of the bar initialize to '2' for both */
xsys='2'; ysys='2';
/* HSYS = 3 MEANS USE PERCENTAGE OF GRAPHICS OUTPUT AREA FOR HEIGHT - I don't think this is being used as there is no size variable */
hsys='3'; when='a';
/* set the initial function and color default  - can be changed later in the step . */
function='label'; color='gray33';

/* Annotate the values at the ends of the bars  -  Set the first bar percentage */
/* this will also print the percentage for the second bar when it comes around*/
/* set the group variable to match grouping on the gchart */
/* This value prints as part of the gaxis  (axis2 definition ) print using the Axis. 
/* There may be another way to print this label that allows me to substitute a different label to the coordinate value */
/* The two slashes in front cause it to skip down and line up in the middle of the two bars */
group=my_order;
yc=source;
x=PERCENT;
/* put the label just at the end of the chart */
function='label'; position='&amp;gt;';
/* build the text label with a leading space */
text='a0'x||put(percent/100,percent7.2);
output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I created the formats to change from my_order to usage_text.&amp;nbsp; And tried to run the report.&amp;nbsp; It replaces the my_order text with the usage_text data but then re-sorts the data on the graph to match the new alpha order for the new formatted values.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;                                                                                                                            
   value $usage_text   
'1-Service Type 1'='&amp;nbsp;\&amp;nbsp;\PService Type 1 has a long description' 
'2-Service Type 2'='&amp;nbsp;\&amp;nbsp;\AService Type 2 medium' 
'3-Service Type 3'='&amp;nbsp;\&amp;nbsp;\MixService Type 3 medium' 
'4-Service Type 4'='&amp;nbsp;\&amp;nbsp;\NType 4 short' ; 
run; 
 proc format;                                                                                                                            
   value $my_order   
'&amp;nbsp;\&amp;nbsp;\PService Type 1 has a long description'= '1-Service Type 1' 
'&amp;nbsp;\&amp;nbsp;\AService Type 2 medium'= '2-Service Type 2'
'&amp;nbsp;\&amp;nbsp;\MixService Type 3 medium'= '3-Service Type 3'
'&amp;nbsp;\&amp;nbsp;\NType 4 short'= '4-Service Type 4'; 
run;

goptions device=png xpixels=800 ypixels=500;

goptions gunit=pct htext=9pt;

ODS LISTING CLOSE;
ODS HTML path=odsout body="&amp;amp;name..htm" style=htmlblue;

axis1 label=none value=none;
axis2 label=none value=(justify=right font='Calibri/bold' h=12pt) split='\' offset=(3,2);
axis3 label=none value=none major=none minor=none style=0 offset=(0,5);

legend1 label=none noframe across=1 position=(top right outside) mode=share value=("Benchmark" "Your Members' Utilization")
shape=bar(.1in,.1in) offset=(-5,8);

pattern1 v=s c=cx48af35;
pattern2 v=s c=gray33;

title1 h=16pt font='Calibri/bold' ls=1.5
box=1 bcolor=cx48af35 color=white 'Member Utilization at a Glance';

proc gchart data= sample_slide4_usage anno=my_anno;
hbar source /  type=sum sumvar=percent nostats
midpoints= "Benchmark" "Your Members' Utilization"
maxis=axis1 
/* commenting this next line should drop the axis label for Usage Type forces the default axis labels */
gaxis=axis2 
raxis=axis3
/*noaxis*/
noframe
/* change group to my_order - originally was usage_text -  modify the order of graphs */
space=0 gspace=4 group=my_order  /* or my_order */
legend=legend1 coutline=same subgroup=source
des='' name="&amp;amp;name";
format my_order $usage_text. ;
run;
/*midpoints =( "&amp;nbsp;\&amp;nbsp;\PService Type 1 has a long description" &amp;nbsp;"&amp;nbsp;\&amp;nbsp;\AService Type 2 medium" "&amp;nbsp;\&amp;nbsp;\MixService Type 3 medium" "&amp;nbsp;\&amp;nbsp;\NType 4 short")*/

quit;
ODS HTML CLOSE;
ODS LISTING;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="This is sorted alphabetically and I want it sorted in the order by Type number" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31931i8EC4F8E8F15BF056/image-size/large?v=v2&amp;amp;px=999" role="button" title="testpn48.png" alt="This is sorted alphabetically and I want it sorted in the order by Type number" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This is sorted alphabetically and I want it sorted in the order by Type number&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="This is how I want is sorted but with the text description being usage text." style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31932i0F82D6B0DC955672/image-size/large?v=v2&amp;amp;px=999" role="button" title="testpn41.png" alt="This is how I want is sorted but with the text description being usage text." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This is how I want is sorted but with the text description being usage text.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:04:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582980#M18744</guid>
      <dc:creator>qaguy1982</dc:creator>
      <dc:date>2019-08-21T20:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the order of alpha categories on group and subgroup levels in a bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582984#M18745</link>
      <description>&lt;P&gt;The format approach is to recode the values to numeric that will sort accordingly, either a format or IF/THEN statements and then using a format to display what you actually want to see.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;

if sex='F' then sex_order = 1;
else if sex='M' then sex_order = 2;
run;

proc format;
value sex_fmt
1 = 'Female'
2 = 'Male';
run;

proc freq data=class;
table sex_order;
format sex_order sex_fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope that illustrates the usage for you, code is untested at the moment.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:12:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/582984#M18745</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-21T20:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the order of alpha categories on group and subgroup levels in a bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/583140#M18746</link>
      <description>&lt;P&gt;Here's one way to do it, assigning a numeric value for the bar groups, and then creating a data-driven user-defined-format to control what text gets printed instead of the bar_order numeric values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data sample_slide4_usage; set sample_slide4_usage;&lt;BR /&gt;if index(usage_text,'PService Type 1 has a long description')^=0 then &lt;STRONG&gt;bar_order=1&lt;/STRONG&gt;;&lt;BR /&gt;if index(usage_text,'AService Type 2 medium')^=0 then &lt;STRONG&gt;bar_order=2&lt;/STRONG&gt;;&lt;BR /&gt;if index(usage_text,'MixService Type 3 medium')^=0 then &lt;STRONG&gt;bar_order=3&lt;/STRONG&gt;;&lt;BR /&gt;if index(usage_text,'NType 4 short')^=0 then &lt;STRONG&gt;bar_order=4&lt;/STRONG&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;create table control as&lt;BR /&gt;select unique &lt;STRONG&gt;bar_order&lt;/STRONG&gt; as start, &lt;STRONG&gt;usage_text&lt;/STRONG&gt; as label&lt;BR /&gt;from sample_slide4_usage;&lt;BR /&gt;quit; run;&lt;BR /&gt;data control; set control;&lt;BR /&gt;fmtname='&lt;STRONG&gt;barfmt&lt;/STRONG&gt;';&lt;BR /&gt;type='N';&lt;BR /&gt;run;&lt;BR /&gt;proc format lib=work cntlin=control;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pattern1 v=s c=cx48af35;&lt;BR /&gt;pattern2 v=s c=gray33;&lt;BR /&gt;axis1 label=none split='\' value=(justify=right);&lt;BR /&gt;axis2 label=none value=none;&lt;BR /&gt;axis3 label=none minor=none;&lt;BR /&gt;legend1 label=none position=(top right) mode=share shape=bar(.15in,.15in) across=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc gchart data= sample_slide4_usage;&lt;BR /&gt;&lt;STRONG&gt;format bar_order barfmt.;&lt;/STRONG&gt;&lt;BR /&gt;hbar source / type=sum sumvar=percent nostats&lt;BR /&gt;&lt;STRONG&gt;group=bar_order&lt;/STRONG&gt; space=0 subgroup=source&lt;BR /&gt;gaxis=axis1 maxis=axis2 raxis=axis3 legend=legend1;&lt;BR /&gt;run;&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="bar_udf.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31951iF840FC14FF108B57/image-size/large?v=v2&amp;amp;px=999" role="button" title="bar_udf.png" alt="bar_udf.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2019 12:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/583140#M18746</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-08-22T12:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the order of alpha categories on group and subgroup levels in a bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/583873#M18780</link>
      <description>&lt;P&gt;Both of these solutions were correct.&amp;nbsp; I am still confused as to why proc format from text to text would not do the same thing.&amp;nbsp; However, I can set the values to numeric and then proc format them to text and it works. &amp;nbsp; I will mark the more complete answer as a solution but I got most of the way with Reeza's response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to both of you.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 12:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-set-the-order-of-alpha-categories-on-group-and-subgroup/m-p/583873#M18780</guid>
      <dc:creator>qaguy1982</dc:creator>
      <dc:date>2019-08-26T12:34:13Z</dc:date>
    </item>
  </channel>
</rss>

