<?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: Customize specific tick values, values order and add space between different hbars groups in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961029#M25333</link>
    <description>&lt;P&gt;Please re-post the code for creating your example data in a text box. Open the text box by clicking on the &amp;lt;/&amp;gt; icon and paste the code. The main message window reformats pasted code and so the there is no space between the end of the Region values and so we get "Region" values that look like "Asia -1.53 20" because of reading 13 characters. Also several of the lines end up to short and get the log note&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of
      a line.
&lt;/PRE&gt;
&lt;P&gt;Which usually indicates a read problem. &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;</description>
    <pubDate>Thu, 06 Mar 2025 03:01:48 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2025-03-06T03:01:48Z</dc:date>
    <item>
      <title>Customize specific tick values, values order and add space between different hbars groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/960973#M25332</link>
      <description>&lt;P&gt;/* Dear all, I would like to know how I could:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create space for the different levels of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;region&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;variable so that the horizontal bars between, for example, Africa and Asia are visually separated more clearly.&lt;/LI&gt;&lt;LI&gt;Organize the graph so that the first horizontal bar is for the region with the highest&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;growth_rate&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in 2024, the second region (the one below the region with the highest&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;growth_rate&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for 2024) is the one with the second highest&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;growth_rate&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in 2024, and so on, so that the last region is the one with the lowest&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;growth_rate&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for 2024.&lt;/LI&gt;&lt;LI&gt;Bold and color in red only "North America" and "South America" on the Y-axis (i.e., I want to draw more attention to these two regions, which are the two I focus my analysis on).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Below is the dataset with the graph I managed to build so far. Unfortunately, I couldn't find a way to achieve the three steps above. Does anyone have any idea how to do it?&lt;/P&gt;&lt;P&gt;Any help is very welcome. Thank you!&lt;BR /&gt;&lt;BR /&gt;*/&lt;BR /&gt;data have;&lt;BR /&gt;input code region $13. growth_rate year;&lt;BR /&gt;datalines;&lt;BR /&gt;0 North America -5.92 2020&lt;BR /&gt;0 North America -2.18 2021&lt;BR /&gt;0 North America -7.47 2022&lt;BR /&gt;0 North America -2.17 2023&lt;BR /&gt;0 North America -9.64 2024&lt;BR /&gt;1 South America 0.36 2020&lt;BR /&gt;1 South America 2.69 2021&lt;BR /&gt;1 South America -8.13 2022&lt;BR /&gt;1 South America 1.22 2023&lt;BR /&gt;1 South America -1.34 2024&lt;BR /&gt;2 Asia -1.53 2020&lt;BR /&gt;2 Asia 2.18 2021&lt;BR /&gt;2 Asia 5.64 2022&lt;BR /&gt;2 Asia 6.80 2023&lt;BR /&gt;2 Asia 8.70 2024&lt;BR /&gt;3 Europe -9.68 2020&lt;BR /&gt;3 Europe 3.91 2021&lt;BR /&gt;3 Europe 5.48 2022&lt;BR /&gt;3 Europe 3.52 2023&lt;BR /&gt;3 Europe 3.69 2024&lt;BR /&gt;4 Africa 3.29 2020&lt;BR /&gt;4 Africa 7.97 2021&lt;BR /&gt;4 Africa 2.48 2022&lt;BR /&gt;4 Africa 7.36 2023&lt;BR /&gt;4 Africa 1.31 2024&lt;BR /&gt;5 Oceania 8.00 2020&lt;BR /&gt;5 Oceania -6.05 2021&lt;BR /&gt;5 Oceania 6.91 2022&lt;BR /&gt;5 Oceania -1.09 2023&lt;BR /&gt;5 Oceania -7.46 2024&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sgplot data=have;&lt;BR /&gt;title "Growth rate";&lt;BR /&gt;styleattrs datacolors=(white blue red orange black)&lt;BR /&gt;datacontrastcolors=(white black black black black)&lt;BR /&gt;datafillpatterns=(r1 r1 l1 x1 l5);&lt;/P&gt;&lt;P&gt;hbar region / response=growth_rate group=year&lt;BR /&gt;groupdisplay=cluster&lt;BR /&gt;clusterwidth=0.9&lt;BR /&gt;datalabel&lt;BR /&gt;datalabelattrs=(size=8pt)&lt;BR /&gt;barwidth=1 nooutline&lt;BR /&gt;transparency=0 dataskin=crisp fillpattern;&lt;/P&gt;&lt;P&gt;xaxis display=(nolabel) min=-12 max=12;&lt;BR /&gt;yaxis display=(nolabel);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 17:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/960973#M25332</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-03-05T17:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Customize specific tick values, values order and add space between different hbars groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961029#M25333</link>
      <description>&lt;P&gt;Please re-post the code for creating your example data in a text box. Open the text box by clicking on the &amp;lt;/&amp;gt; icon and paste the code. The main message window reformats pasted code and so the there is no space between the end of the Region values and so we get "Region" values that look like "Asia -1.53 20" because of reading 13 characters. Also several of the lines end up to short and get the log note&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: SAS went to a new line when INPUT statement reached past the end of
      a line.
&lt;/PRE&gt;
&lt;P&gt;Which usually indicates a read problem. &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;</description>
      <pubDate>Thu, 06 Mar 2025 03:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961029#M25333</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-03-06T03:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Customize specific tick values, values order and add space between different hbars groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961031#M25334</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input code region &amp;amp;$20. growth_rate year;
datalines;
0 North America  -5.92 2020
0 North America  -2.18 2021
0 North America  -7.47 2022
0 North America  -2.17 2023
0 North America  -9.64 2024
1 South America  0.36 2020
1 South America  2.69 2021
1 South America  -8.13 2022
1 South America  1.22 2023
1 South America  -1.34 2024
2 Asia  -1.53 2020
2 Asia  2.18 2021
2 Asia  5.64 2022
2 Asia  6.80 2023
2 Asia  8.70 2024
3 Europe  -9.68 2020
3 Europe  3.91 2021
3 Europe  5.48 2022
3 Europe  3.52 2023
3 Europe  3.69 2024
4 Africa  3.29 2020
4 Africa  7.97 2021
4 Africa  2.48 2022
4 Africa  7.36 2023
4 Africa  1.31 2024
5 Oceania  8.00 2020
5 Oceania  -6.05 2021
5 Oceania  6.91 2022
5 Oceania  -1.09 2023
5 Oceania  -7.46 2024
;
run;

proc sort data=have(where=(year=2024)) out=temp;
by growth_rate  ;
run;
data fmt;
 set temp(rename=(region=start));
 retain fmtname 'fmt' type 'c';
 length label $ 80;
 label=repeat(' ',_n_)||strip(start);
 keep fmtname type start label;
run;
proc format cntlin=fmt;
run;
data have2;
 set have;
 _region=put(region,$fmt32.);
 if region="North America" then call symput('NorthAmerica',_region);
 if region="South America" then call symput('SouthAmerica',_region);
run;


%sganno
data sganno;
 %SGTEXT(LABEL="North America",TEXTWEIGHT="BOLD",TEXTCOLOR="RED",TEXTSIZE=10, FILLCOLOR="white",FILLTRANSPARENCY=0,WIDTH=40,Y1SPACE="DATAVALUE",X1SPACE="LAYOUTPERCENT",YC1="&amp;amp;NorthAmerica.",X1=6 )
 %SGTEXT(LABEL="South America",TEXTWEIGHT="BOLD",TEXTCOLOR="RED",TEXTSIZE=10, FILLCOLOR="white",FILLTRANSPARENCY=0,WIDTH=40,Y1SPACE="DATAVALUE",X1SPACE="LAYOUTPERCENT",YC1="&amp;amp;SouthAmerica" ,X1=6 )
run;


proc sgplot data=have2 sganno=sganno;
title "Growth rate";
styleattrs datacolors=(white blue red orange black)
datacontrastcolors=(white black black black black)
datafillpatterns=(r1 r1 l1 x1 l5);

hbar _region / response=growth_rate group=year 
groupdisplay=cluster
clusterwidth=0.9
datalabel DATALABELFITPOLICY=NONE
datalabelattrs=(size=8pt)
barwidth=1 nooutline
transparency=0 dataskin=crisp fillpattern;

xaxis display=(nolabel) min=-12 max=12;
yaxis display=(nolabel) colorbands=even ;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1741231645738.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/105195i53FCCAA082C21930/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1741231645738.png" alt="Ksharp_0-1741231645738.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 03:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961031#M25334</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-03-06T03:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Customize specific tick values, values order and add space between different hbars groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961092#M25335</link>
      <description>&lt;P&gt;Sorry, I did not know that the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;&amp;amp;&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;modifier in the input statement indicates that the character variable can contain spaces. This allows SAS to read the variable until it encounters two or more consecutive spaces or the end of the line. Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;for correcting my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here it is posted again:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input code region &amp;amp;$20. growth_rate year;&lt;BR /&gt;datalines;&lt;BR /&gt;0 North America&amp;nbsp; -5.92 2020&lt;BR /&gt;0 North America&amp;nbsp; -2.18 2021&lt;BR /&gt;0 North America&amp;nbsp; -7.47 2022&lt;BR /&gt;0 North America&amp;nbsp; -2.17 2023&lt;BR /&gt;0 North America&amp;nbsp; -9.64 2024&lt;BR /&gt;1 South America&amp;nbsp; 0.36 2020&lt;BR /&gt;1 South America&amp;nbsp; 2.69 2021&lt;BR /&gt;1 South America&amp;nbsp; -8.13 2022&lt;BR /&gt;1 South America&amp;nbsp; 1.22 2023&lt;BR /&gt;1 South America&amp;nbsp; -1.34 2024&lt;BR /&gt;2 Asia&amp;nbsp; -1.53 2020&lt;BR /&gt;2 Asia&amp;nbsp; 2.18 2021&lt;BR /&gt;2 Asia&amp;nbsp; 5.64 2022&lt;BR /&gt;2 Asia&amp;nbsp; 6.80 2023&lt;BR /&gt;2 Asia&amp;nbsp; 8.70 2024&lt;BR /&gt;3 Europe&amp;nbsp; -9.68 2020&lt;BR /&gt;3 Europe&amp;nbsp; 3.91 2021&lt;BR /&gt;3 Europe&amp;nbsp; 5.48 2022&lt;BR /&gt;3 Europe&amp;nbsp; 3.52 2023&lt;BR /&gt;3 Europe&amp;nbsp; 3.69 2024&lt;BR /&gt;4 Africa&amp;nbsp; 3.29 2020&lt;BR /&gt;4 Africa&amp;nbsp; 7.97 2021&lt;BR /&gt;4 Africa&amp;nbsp; 2.48 2022&lt;BR /&gt;4 Africa&amp;nbsp; 7.36 2023&lt;BR /&gt;4 Africa&amp;nbsp; 1.31 2024&lt;BR /&gt;5 Oceania&amp;nbsp; 8.00 2020&lt;BR /&gt;5 Oceania&amp;nbsp; -6.05 2021&lt;BR /&gt;5 Oceania&amp;nbsp; 6.91 2022&lt;BR /&gt;5 Oceania&amp;nbsp; -1.09 2023&lt;BR /&gt;5 Oceania&amp;nbsp; -7.46 2024&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;I think it works now.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 15:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961092#M25335</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-03-06T15:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Customize specific tick values, values order and add space between different hbars groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961105#M25336</link>
      <description>&lt;P&gt;Wow! That's really a great solution!&amp;nbsp;&lt;SPAN&gt;From now on, I will be able to finish customizing the graph on my own. I confess that I didn't know about the&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;sganno&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;option in&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;sgplot&lt;/CODE&gt;&lt;SPAN&gt;. It is indeed interesting, I will continue to explore it further.&amp;nbsp;Thanks a lot!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 15:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customize-specific-tick-values-values-order-and-add-space/m-p/961105#M25336</guid>
      <dc:creator>MFraga</dc:creator>
      <dc:date>2025-03-06T15:50:30Z</dc:date>
    </item>
  </channel>
</rss>

