<?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 three X Y scatter for each group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630452#M186647</link>
    <description>&lt;P&gt;For three plots in one image, you will want to use Proc SGPANEL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;PANELBY statement lets you specify the variables (1 or 2) that control the data subset going each panels.&lt;/LI&gt;
&lt;LI&gt;SCATTER statement lets you specify the X and Y variables, and the data point labeling variable.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proper data is important, the sample in your question does not input properly.&amp;nbsp; The sample code below fixes the input:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
attrib 
  country_code length=$2
  industry     length=$20 label = "INDUSTRY"
  rnd          format=dollar12. label = 'R &amp;amp; D'
  patents      format=dollar12. label = 'Patent'
;

INFILE CARDS DSD DLM=','; input
country_code industry rnd patents;
datalines;
AT,Manufacture,4316550,2033058
AU,Manufacture,2701929,961452
BE,Manufacture,1935804,564041
AT,Service,2069617,483619
AU,Service,1058213,235353
BE,Service,1024675,60304
AT,Oil,1725920,242679
AU,Oil,2178870,543554
BE,Oil,1024675,60304
;

proc sgpanel data=have;
  panelby industry / columns=1;
  scatter x=patents y=rnd / datalabel=country_code;  
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 456px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36683i4D99059BD820F278/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Mar 2020 03:17:03 GMT</pubDate>
    <dc:creator>RichardDeVen</dc:creator>
    <dc:date>2020-03-08T03:17:03Z</dc:date>
    <item>
      <title>create three X Y scatter for each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630447#M186645</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I expect to create a figure&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the following data,&lt;/P&gt;&lt;PRE&gt;data have;&lt;BR /&gt;INFILE CARDS DSD DLM=',';&lt;BR /&gt;input&lt;BR /&gt;CTRY :$10.&lt;BR /&gt;INDUSTRY :$29.&lt;BR /&gt;R&amp;amp;D :8&lt;BR /&gt;PATENTS :8&lt;BR /&gt;;&lt;BR /&gt;cards;&lt;BR /&gt;AT,Manufacure,4316550,2033058&lt;BR /&gt;AU,Manufacure,2701929,961452&lt;BR /&gt;BE,Manufacure,1935804,564041&lt;BR /&gt;AT,Service,2069617,483619&lt;BR /&gt;AU,Service,1058213,235353&lt;BR /&gt;BE,Service,1024675,60304&lt;BR /&gt;AT,Oil,1725920,242679&lt;BR /&gt;AU,Oil,2178870,543554&lt;BR /&gt;BE,Oil,1024675,60304&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;I expect to create three X Y scatter for each INDUSTRY&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to put the value of "R&amp;amp;D" at Y-axis&amp;nbsp;and value of "Patent" at X-axis&amp;nbsp;and the value of "&lt;CODE class=" language-sas"&gt;INDUSTRY" as the title of each scatter.&amp;nbsp;SO the value of each country is expected to be displayed as a point on each scatter chart.&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please give me some suggestion about this?&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2020 01:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630447#M186645</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2020-03-08T01:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: create three X Y scatter for each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630450#M186646</link>
      <description>&lt;P&gt;Have you tried the first example in SGPLOT documentation?&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n06fb9ichgg6akn18060gbtvw9pw.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n06fb9ichgg6akn18060gbtvw9pw.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;To split by industry instead of group it, use a BY statement and don’t use the GROUP option.&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I expect to create a figure&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for the following data,&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;INFILE CARDS DSD DLM=',';&lt;BR /&gt;input&lt;BR /&gt;CTRY :$10.&lt;BR /&gt;INDUSTRY :$29.&lt;BR /&gt;R&amp;amp;D :8&lt;BR /&gt;PATENTS :8&lt;BR /&gt;;&lt;BR /&gt;cards;&lt;BR /&gt;AT,Manufacure,4316550,2033058&lt;BR /&gt;AU,Manufacure,2701929,961452&lt;BR /&gt;BE,Manufacure,1935804,564041&lt;BR /&gt;AT,Service,2069617,483619&lt;BR /&gt;AU,Service,1058213,235353&lt;BR /&gt;BE,Service,1024675,60304&lt;BR /&gt;AT,Oil,1725920,242679&lt;BR /&gt;AU,Oil,2178870,543554&lt;BR /&gt;BE,Oil,1024675,60304&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;I expect to create three X Y scatter for each INDUSTRY&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to put the value of "R&amp;amp;D" at Y-axis&amp;nbsp;and value of "Patent" at X-axis&amp;nbsp;and the value of "&lt;CODE class=" language-sas"&gt;INDUSTRY" as the title of each scatter.&amp;nbsp;SO the value of each country is expected to be displayed as a point on each scatter chart.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please give me some suggestion about this?&lt;/P&gt;
&lt;P&gt;thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2020 03:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630450#M186646</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-08T03:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: create three X Y scatter for each group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630452#M186647</link>
      <description>&lt;P&gt;For three plots in one image, you will want to use Proc SGPANEL.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;PANELBY statement lets you specify the variables (1 or 2) that control the data subset going each panels.&lt;/LI&gt;
&lt;LI&gt;SCATTER statement lets you specify the X and Y variables, and the data point labeling variable.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proper data is important, the sample in your question does not input properly.&amp;nbsp; The sample code below fixes the input:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
attrib 
  country_code length=$2
  industry     length=$20 label = "INDUSTRY"
  rnd          format=dollar12. label = 'R &amp;amp; D'
  patents      format=dollar12. label = 'Patent'
;

INFILE CARDS DSD DLM=','; input
country_code industry rnd patents;
datalines;
AT,Manufacture,4316550,2033058
AU,Manufacture,2701929,961452
BE,Manufacture,1935804,564041
AT,Service,2069617,483619
AU,Service,1058213,235353
BE,Service,1024675,60304
AT,Oil,1725920,242679
AU,Oil,2178870,543554
BE,Oil,1024675,60304
;

proc sgpanel data=have;
  panelby industry / columns=1;
  scatter x=patents y=rnd / datalabel=country_code;  
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 456px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36683i4D99059BD820F278/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2020 03:17:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-three-X-Y-scatter-for-each-group/m-p/630452#M186647</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-03-08T03:17:03Z</dc:date>
    </item>
  </channel>
</rss>

