<?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 proc sgplot label y axis with another character variable in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737355#M21448</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=example noautolegend;&lt;BR /&gt;styleattrs datasymbols=(circlefilled );&lt;BR /&gt;scatter x=b y=a ;&lt;BR /&gt;keylegend / location=outside position=NW across=1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the above code, is it possible to label the y axis using variable "CAT" to make the y-axis more meaningful?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CAT&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT6&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&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>Tue, 27 Apr 2021 18:06:11 GMT</pubDate>
    <dc:creator>zimcom</dc:creator>
    <dc:date>2021-04-27T18:06:11Z</dc:date>
    <item>
      <title>proc sgplot label y axis with another character variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737355#M21448</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=example noautolegend;&lt;BR /&gt;styleattrs datasymbols=(circlefilled );&lt;BR /&gt;scatter x=b y=a ;&lt;BR /&gt;keylegend / location=outside position=NW across=1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the above code, is it possible to label the y axis using variable "CAT" to make the y-axis more meaningful?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;CAT&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT3&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT4&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT6&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&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>Tue, 27 Apr 2021 18:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737355#M21448</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2021-04-27T18:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot label y axis with another character variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737401#M21454</link>
      <description>&lt;P&gt;I might suggest simply trying y=cat as a first simple to test code.&lt;/P&gt;
&lt;P&gt;When a character variable is used for a yaxis like that the first alphabetic value will be closest to the x axis and be in ascending alphabetical value from bottom to top.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that isn't sufficient then I would use your A and Cat values to make a format then apply the format to the A variable in the plot.&lt;/P&gt;
&lt;PRE&gt;proc format;
value AtoCat
1= 'Cat 1'
2= 'Cat 2'
&amp;lt;repeat as needed&amp;gt;
;&lt;BR /&gt;&lt;BR /&gt;proc sgplot data=example noautolegend;&lt;BR /&gt;   styleattrs datasymbols=(circlefilled );&lt;BR /&gt;   scatter x=b y=a ;&lt;BR /&gt;   keylegend / location=outside position=NW across=1;&lt;BR /&gt;   format a AtoCat. ;&lt;BR /&gt;run;

&lt;/PRE&gt;
&lt;P&gt;If you have LOTS of A values you may need to use a YAXIS statement to make the axis TYPE=Discrete and set a FITPOLICY=none to force all the values to have a tick mark to label.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 19:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737401#M21454</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-27T19:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot label y axis with another character variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737409#M21455</link>
      <description>&lt;P&gt;Does a scatter plot make sense for your data? Also&lt;BR /&gt;&lt;BR /&gt;Either way, another option is to list the values on the XAXIS statement but the FORMAT is definitely the better answer.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select quote(cat) into :labels_list separated by " " from example order by a;
select quote(a) into :values_list separated by " " from example order by a;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Then add this to your PROC SGPLOT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;XAXIS VALUES = (&amp;amp;values_list.) VALUESDISPLAY = (&amp;amp;labels_list.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737409#M21455</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-04-27T20:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot label y axis with another character variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737413#M21456</link>
      <description>Thank you, it works!&lt;BR /&gt;The reasxon I cannot use trying y=cat, becasure there is correlation between the 2 variavles, as you pointed out the alphabetical order will screw the corelation.&lt;BR /&gt;But the 2nd solution works perfect!</description>
      <pubDate>Tue, 27 Apr 2021 20:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737413#M21456</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2021-04-27T20:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot label y axis with another character variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737414#M21457</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, you have been always so helpful too !!</description>
      <pubDate>Tue, 27 Apr 2021 20:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-label-y-axis-with-another-character-variable/m-p/737414#M21457</guid>
      <dc:creator>zimcom</dc:creator>
      <dc:date>2021-04-27T20:30:07Z</dc:date>
    </item>
  </channel>
</rss>

