<?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: Create a pie chart using GTL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-pie-chart-using-GTL/m-p/885228#M349776</link>
    <description>&lt;P&gt;Have a look at the example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;discreteattrmap name="piecolors";
  value "F" / fillattrs=(color=pink);
  value "M" / fillattrs=(color=light_blue);
enddiscreteattrmap;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For documentation see: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1jzx3nmuupe74n1qy54onbwjoem.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1jzx3nmuupe74n1qy54onbwjoem.htm&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jul 2023 09:36:25 GMT</pubDate>
    <dc:creator>JosvanderVelden</dc:creator>
    <dc:date>2023-07-18T09:36:25Z</dc:date>
    <item>
      <title>Create a pie chart using GTL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-pie-chart-using-GTL/m-p/885178#M349745</link>
      <description>&lt;P&gt;Hello, I am trying to use GTL to create a pie chart that presents the reason (reason_call) calls a standard in a health center.the graph is published on a web portal. We would like that when the user moves the cursor on a pie, a tooltip displays the reason for the call (reason_call), the frequency of the reason (number_reason_call) and the proportion (pct_reason_call).&lt;BR /&gt;I try to use the DISCRETEATTRMAP statement to make sure that the different reasons retain the same colors over time and regardless of the user. The problem is that the reason_call variable has too many modalities and from one day to another this can vary (the update is done daily). so I have trouble using the DISCRETEATTRMAP statement ca not being able to list all the reasons.&lt;BR /&gt;I would like a graph like the one below with the same legend&lt;BR /&gt;I manage to create the pie chart. But I have trouble customizing the colors, tips and caption.&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;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IdrissaO_0-1689626741344.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85867iDC7E1FCD5FAC934C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="IdrissaO_0-1689626741344.png" alt="IdrissaO_0-1689626741344.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;Voici le programme&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data data4pieChart;
	length raison_legend $ 60; /* over-sized, but that is harmless */
	set Mydata;

		raison_legend=strip(reason_call)||" (N = "||strip(number_reason_call)||", p = "||strip(pct_reason_call)|| " %)" ;
		rpt='title="' || trim(left("RaisonLabel")) ||' : ' || '09'x || trim(left(raison_m)) ||
						'0D'x || trim(left("NumberLabel")) ||' : ' || '09'x || trim(left(put(number_reason_call,NumberFmt.))) ||
						'0D'x || trim(left("PctLabel")) ||' : ' || '09'x || trim(left(pct_reason_call)) || " %" ||'"';		
run;



proc template;
	define statgraph piechart;
		begingraph;/*
			discreteattrmap name="piecolors";
				???
			enddiscreteattrmap;*/
			*discreteattrvar attrvar=reason_call_mapped var=reason_call attrmap="piecolors";
			layout region ;
				piechart category=reason_call  response=number_reason_call/ 
					tip=(reason_call number_reason_call pct_reason_call) 
					tipformat =($RaisonFmt. NumberFmt. z5.1)
					tiplabel=("RaisonLabel" "NumberLabel" "PctLabel")							
					datalabelcontent=(category)
					start=0 
					categorydirection=clockwise  
					datalabellocation=callout 
					otherslice=false ;
				
				discretelegend "piechart" / 
					location=outside 
					halign=right 
					valign=center
					border=false  
					across=1;
	
			endlayout;
		endgraph;
	end;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 21:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-pie-chart-using-GTL/m-p/885178#M349745</guid>
      <dc:creator>IdrissaO</dc:creator>
      <dc:date>2023-07-17T21:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create a pie chart using GTL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-pie-chart-using-GTL/m-p/885228#M349776</link>
      <description>&lt;P&gt;Have a look at the example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;discreteattrmap name="piecolors";
  value "F" / fillattrs=(color=pink);
  value "M" / fillattrs=(color=light_blue);
enddiscreteattrmap;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For documentation see: &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1jzx3nmuupe74n1qy54onbwjoem.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1jzx3nmuupe74n1qy54onbwjoem.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 09:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-pie-chart-using-GTL/m-p/885228#M349776</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2023-07-18T09:36:25Z</dc:date>
    </item>
  </channel>
</rss>

