<?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: Order groups glm in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599413#M19021</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290726"&gt;@AnaVelloso&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe it's even easier and you just need to specify &lt;FONT face="courier new,courier"&gt;order=&lt;STRONG&gt;internal&lt;/STRONG&gt;&lt;/FONT&gt; in the PROC GLM statement. This would be sufficient if '&amp;lt;12' etc. were just &lt;EM&gt;formatted&lt;/EM&gt; values of variable &lt;FONT face="courier new,courier"&gt;Educ&lt;/FONT&gt;, whose&amp;nbsp;&lt;EM&gt;internal&lt;/EM&gt; values (e.g., numeric values 1, 2, ...) reflected the desired sort order. (This is a common technique to avoid exactly these sorting issues.) Can you check in PROC CONTENTS output if &lt;FONT face="courier new,courier"&gt;Educ&lt;/FONT&gt; is numeric or character and whether a format is associated with it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If, however, &lt;FONT face="courier new,courier"&gt;Educ&lt;/FONT&gt; is an unformatted character variable with values '&amp;lt;12' etc. you can create a &lt;EM&gt;view&lt;/EM&gt; before the PROC GLM step and use this instead of another dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create view _incomes as
select * from incomes
order by whichc(educ,'&amp;lt;12','12','13-15','16','&amp;gt;16');
quit;

ods graphics on;
proc glm data = _incomes plots=diagnostics order=data;
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 25 Oct 2019 17:14:16 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2019-10-25T17:14:16Z</dc:date>
    <item>
      <title>Order groups glm</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599390#M19016</link>
      <description>&lt;P&gt;I have a set of data where I am doing a Tukey's test. I woud like to change the order of how it showing in my graphs, placing first ,&amp;lt;12, 12, 13-15, 16 and &amp;gt;16. Any tip of how I can change this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;BR /&gt;proc glm data = incomes plots =diagnostics;&lt;BR /&gt;class Educ;&lt;BR /&gt;model Income2005=Educ ;&lt;BR /&gt;lsmeans Educ/stderr pdiff=all adjust=tukey;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Boxplot.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33406i88AE2F2B6789F9E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Boxplot.jpg" alt="Boxplot.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599390#M19016</guid>
      <dc:creator>AnaVelloso</dc:creator>
      <dc:date>2019-10-25T16:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Order groups glm</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599397#M19017</link>
      <description>&lt;P&gt;Sort your data by Educ and use &lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_glm_syntax01.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en#statug.glm.orderopt" target="_self"&gt;Order=Data&lt;/A&gt; in the PROC GLM Statement like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.iris out=test1;
   by descending Species;
run;

proc glm data=test1 plots=diagnostics order=data;
class Species;
model SepalLength=Species;
lsmeans Species / stderr pdiff=all adjust=tukey;
run;quit;

proc sort data=sashelp.iris out=test2;
   by Species;
run;

proc glm data=test2 plots=diagnostics order=data;
class Species;
model SepalLength=Species;
lsmeans Species / stderr pdiff=all adjust=tukey;
run;quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Plot from first GLM:&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="desc.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33409iBE298E844661A3F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="desc.png" alt="desc.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;&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;
&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;
&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;
&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plot from second GLM:&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="asc.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33410iDAA5562F9D95994A/image-size/large?v=v2&amp;amp;px=999" role="button" title="asc.png" alt="asc.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599397#M19017</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-25T16:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Order groups glm</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599406#M19019</link>
      <description>&lt;P&gt;I am having troubles to sort the data with symbols.. I am pretty new using SAS, when is numbers or alphabetic order not problem but now I have symbols and numbers&amp;nbsp; &amp;lt;12,&amp;nbsp; &amp;gt;16 how I can short the data that comes in the order &amp;lt;12, 12, 13-15, 16, &amp;gt;16?&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599406#M19019</guid>
      <dc:creator>AnaVelloso</dc:creator>
      <dc:date>2019-10-25T16:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Order groups glm</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599407#M19020</link>
      <description>&lt;P&gt;There are several ways to do this, but here is a format approach to get the sort right:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input educ $;
datalines;
&amp;lt;12
12
13-15
&amp;lt;12
12
13-15
16 
&amp;gt;16?
16 
&amp;lt;12
12
13-15
16 
&amp;gt;16?
&amp;gt;16?
;

proc format;
   value $ fmt
      '&amp;lt;12'    = 1
      '12'     = 2
      '13-15'  = 3
      '16'     = 4
      '&amp;gt;16?'   = 5
   ;
run;

proc sql;
   create table sorted as 
   select * from test
   order by put(educ, $fmt.);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;educ 
&amp;lt;12 
&amp;lt;12 
&amp;lt;12 
12 
12 
12 
13-15 
13-15 
13-15 
16 
16 
16 
&amp;gt;16? 
&amp;gt;16? 
&amp;gt;16? 
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599407#M19020</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-10-25T16:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Order groups glm</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599413#M19021</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290726"&gt;@AnaVelloso&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe it's even easier and you just need to specify &lt;FONT face="courier new,courier"&gt;order=&lt;STRONG&gt;internal&lt;/STRONG&gt;&lt;/FONT&gt; in the PROC GLM statement. This would be sufficient if '&amp;lt;12' etc. were just &lt;EM&gt;formatted&lt;/EM&gt; values of variable &lt;FONT face="courier new,courier"&gt;Educ&lt;/FONT&gt;, whose&amp;nbsp;&lt;EM&gt;internal&lt;/EM&gt; values (e.g., numeric values 1, 2, ...) reflected the desired sort order. (This is a common technique to avoid exactly these sorting issues.) Can you check in PROC CONTENTS output if &lt;FONT face="courier new,courier"&gt;Educ&lt;/FONT&gt; is numeric or character and whether a format is associated with it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If, however, &lt;FONT face="courier new,courier"&gt;Educ&lt;/FONT&gt; is an unformatted character variable with values '&amp;lt;12' etc. you can create a &lt;EM&gt;view&lt;/EM&gt; before the PROC GLM step and use this instead of another dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create view _incomes as
select * from incomes
order by whichc(educ,'&amp;lt;12','12','13-15','16','&amp;gt;16');
quit;

ods graphics on;
proc glm data = _incomes plots=diagnostics order=data;
...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Oct 2019 17:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Order-groups-glm/m-p/599413#M19021</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-10-25T17:14:16Z</dc:date>
    </item>
  </channel>
</rss>

