<?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 label some points in a scatter plot with a character name? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610808#M177935</link>
    <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Dec 2019 19:38:01 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-12-10T19:38:01Z</dc:date>
    <item>
      <title>How to label some points in a scatter plot with a character name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610651#M177858</link>
      <description>&lt;P&gt;Dear programmers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I like to give a character name in a SCATTER PLOT to some points which their position are in a certain area in the plot (with respect to X- and Y-axis).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the following dataset, I want the points between 3&amp;lt;x&amp;lt;8 and 3&amp;lt;y&amp;lt;8 to have the label D, E, F and G.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data person;&lt;BR /&gt;infile datalines delimiter=','; &lt;BR /&gt;input name $ X Y;&lt;BR /&gt;datalines;&lt;BR /&gt;A, 1, 1&lt;BR /&gt;B, 2, 2&lt;BR /&gt;C, 3, 3&lt;BR /&gt;D, 4, 4&lt;BR /&gt;E, 5, 5&lt;BR /&gt;F, 6, 6&lt;BR /&gt;G, 7, 7&lt;BR /&gt;H, 8, 8&lt;BR /&gt;I, 9, 9&lt;BR /&gt;J, 10, 10&lt;BR /&gt;K, 11, 11&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%_eg_conditional_dropds(WORK.SORTTempTableSorted);&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE VIEW WORK.SORTTempTableSorted AS&lt;BR /&gt;SELECT T.X, T.Y&lt;BR /&gt;FROM WORK.PERSON as T&lt;BR /&gt;;&lt;BR /&gt;QUIT;&lt;BR /&gt;SYMBOL1&lt;BR /&gt;INTERPOL=NONE&lt;BR /&gt;HEIGHT=3pt&lt;BR /&gt;VALUE=CIRCLE&lt;BR /&gt;LINE=1&lt;BR /&gt;WIDTH=1&lt;/P&gt;
&lt;P&gt;CV = _STYLE_&lt;BR /&gt;;&lt;BR /&gt;Axis1&lt;BR /&gt;STYLE=1&lt;BR /&gt;WIDTH=1&lt;BR /&gt;MINOR=NONE&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;;&lt;BR /&gt;Axis2&lt;BR /&gt;STYLE=1&lt;BR /&gt;WIDTH=1&lt;BR /&gt;MINOR=NONE&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;;&lt;BR /&gt;TITLE;&lt;BR /&gt;TITLE1 "Scatter Plot";&lt;BR /&gt;FOOTNOTE;&lt;BR /&gt;FOOTNOTE1 "Generated by the SAS System (&amp;amp;_SASSERVERNAME, &amp;amp;SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";&lt;BR /&gt;PROC GPLOT DATA=WORK.SORTTempTableSorted&lt;BR /&gt;;&lt;BR /&gt;PLOT Y * X / &lt;BR /&gt;VAXIS=AXIS1&lt;/P&gt;
&lt;P&gt;HAXIS=AXIS2&lt;/P&gt;
&lt;P&gt;FRAME ;&lt;BR /&gt;RUN; QUIT;&lt;BR /&gt;%_eg_conditional_dropds(WORK.SORTTempTableSorted);&lt;BR /&gt;TITLE; FOOTNOTE;&lt;BR /&gt;GOPTIONS RESET = SYMBOL;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I modify the code to perform this job?&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Farshid Owrang&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 09:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610651#M177858</guid>
      <dc:creator>farshidowrang</dc:creator>
      <dc:date>2019-12-10T09:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to label some points in a scatter plot with a character name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610661#M177865</link>
      <description>&lt;P&gt;If I understand you correctly, here is a way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data person;
infile datalines delimiter=',';
input name $ X Y;
datalines;
A, 1, 1
B, 2, 2
C, 3, 3
D, 4, 4
E, 5, 5
F, 6, 6
G, 7, 7
H, 8, 8
I, 9, 9
J, 10, 10
K, 11, 11
;

data temp / view=temp;
    set person;
    if 3&amp;lt;x&amp;lt;8 and 3&amp;lt;y&amp;lt;8 then text=name;
    else do; sx=x; sy=y; end;
run;

proc sgplot data=temp;
    scatter x=sx y=sy;
    text x=x y=y text=text;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&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-left" image-alt="Udklip.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34576i376345B605738BAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Udklip.PNG" alt="Udklip.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 10:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610661#M177865</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-12-10T10:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to label some points in a scatter plot with a character name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610707#M177891</link>
      <description>&lt;P&gt;Thank you very much!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Is it possible that I get the letters above the points?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Farshid&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 12:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610707#M177891</guid>
      <dc:creator>farshidowrang</dc:creator>
      <dc:date>2019-12-10T12:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to label some points in a scatter plot with a character name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610732#M177904</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data person;
infile datalines delimiter=',';
input name $ X Y;
datalines;
A, 1, 1
B, 2, 2
C, 3, 3
D, 4, 4
E, 5, 5
F, 6, 6
G, 7, 7
H, 8, 8
I, 9, 9
J, 10, 10
K, 11, 11
;

data temp / view=temp;
    set person;
    if 3&amp;lt;x&amp;lt;8 and 3&amp;lt;y&amp;lt;8 then text=name;
run;

proc sgplot data=temp;
    scatter x=y y=y / datalabel=text datalabelpos=top;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Dec 2019 13:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610732#M177904</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-12-10T13:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to label some points in a scatter plot with a character name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610755#M177913</link>
      <description>&lt;P&gt;Thank you very much!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Farshid&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 15:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610755#M177913</guid>
      <dc:creator>farshidowrang</dc:creator>
      <dc:date>2019-12-10T15:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to label some points in a scatter plot with a character name?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610808#M177935</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 19:38:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-label-some-points-in-a-scatter-plot-with-a-character-name/m-p/610808#M177935</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-12-10T19:38:01Z</dc:date>
    </item>
  </channel>
</rss>

