<?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: Proc Tabulate - Order of Class Variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481255#M71607</link>
    <description>&lt;P&gt;Check out the CLASSDATA= option it allows you to provide the data in a specific sequence. Additionally it provides a way to provide class values for which there is no data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards dsd;
  input 
    gradText : $30.
  ;
  seqNr + 1;
  random = rand("uniform");
  someValue = ceil( random * 100 );
cards;
'3-Year and Under Graduate'
'4-Year Graduate'
'5-Year Graduate'
'6-Year Graduate'
'7-Year Graduate'
'8-Year Graduate'
'9-Year Graduate'
'10-Year Graduate'
;

data classOrder;
  set have;
  keep gradtext;
run;

proc sort data=have out=have2;
  by random;
run;

proc tabulate data=have2 classdata=classorder;
  class gradText / order=data;
  var someValue;
  table 
    gradText, someValue
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Jul 2018 20:24:16 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2018-07-25T20:24:16Z</dc:date>
    <item>
      <title>Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481178#M71590</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a class variable: time_to_graduation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Time_to_graduation has the following possibilities:&lt;/P&gt;&lt;P&gt;'3-Year and Under Graduate'&lt;BR /&gt;'4-Year Graduate'&lt;BR /&gt;'5-Year Graduate'&lt;BR /&gt;'6-Year Graduate'&lt;BR /&gt;'7-Year Graduate'&lt;BR /&gt;'8-Year Graduate'&lt;BR /&gt;'9-Year Graduate'&lt;BR /&gt;'10-Year Graduate'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They are not tabulating in order I have listed. I numbered them intuitively hoping I wouldn't have to do any type of format step. Those hopes, however, were dashed when I tabulated the variable.&amp;nbsp; Let's just say, they are not in order.&amp;nbsp; I've attempted various fixes, but I can't seem to get it to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice on getting the tabulation to display the time_to_graduate class variable to tabulate in the order i have above?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 16:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481178#M71590</guid>
      <dc:creator>eer_seer</dc:creator>
      <dc:date>2018-07-25T16:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481183#M71592</link>
      <description>&lt;P&gt;Replace them with codes, 1, 2, 3 etc in the correct order and then use a format to have the value displayed instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/92495"&gt;@eer_seer&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a class variable: time_to_graduation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Time_to_graduation has the following possibilities:&lt;/P&gt;
&lt;P&gt;'3-Year and Under Graduate'&lt;BR /&gt;'4-Year Graduate'&lt;BR /&gt;'5-Year Graduate'&lt;BR /&gt;'6-Year Graduate'&lt;BR /&gt;'7-Year Graduate'&lt;BR /&gt;'8-Year Graduate'&lt;BR /&gt;'9-Year Graduate'&lt;BR /&gt;'10-Year Graduate'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They are not tabulating in order I have listed. I numbered them intuitively hoping I wouldn't have to do any type of format step. Those hopes, however, were dashed when I tabulated the variable.&amp;nbsp; Let's just say, they are not in order.&amp;nbsp; I've attempted various fixes, but I can't seem to get it to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any advice on getting the tabulation to display the time_to_graduate class variable to tabulate in the order i have above?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 16:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481183#M71592</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-25T16:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481195#M71594</link>
      <description>&lt;P&gt;I follow on the first part of your suggestion, don't follow on the second.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 17:15:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481195#M71594</guid>
      <dc:creator>eer_seer</dc:creator>
      <dc:date>2018-07-25T17:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481200#M71595</link>
      <description>&lt;P&gt;As a character string, the values are alphabetized.&amp;nbsp; Since "1" alphabetizes before other digits, "10" will come out first.&amp;nbsp; A simple fix would be to add a blank before all the single-digit values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;' 3-Year and Under Graduate'&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2018 17:23:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481200#M71595</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-25T17:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481255#M71607</link>
      <description>&lt;P&gt;Check out the CLASSDATA= option it allows you to provide the data in a specific sequence. Additionally it provides a way to provide class values for which there is no data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards dsd;
  input 
    gradText : $30.
  ;
  seqNr + 1;
  random = rand("uniform");
  someValue = ceil( random * 100 );
cards;
'3-Year and Under Graduate'
'4-Year Graduate'
'5-Year Graduate'
'6-Year Graduate'
'7-Year Graduate'
'8-Year Graduate'
'9-Year Graduate'
'10-Year Graduate'
;

data classOrder;
  set have;
  keep gradtext;
run;

proc sort data=have out=have2;
  by random;
run;

proc tabulate data=have2 classdata=classorder;
  class gradText / order=data;
  var someValue;
  table 
    gradText, someValue
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jul 2018 20:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/481255#M71607</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2018-07-25T20:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/483074#M71688</link>
      <description>&lt;P&gt;Ok, great!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is helpful as well.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 13:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/483074#M71688</guid>
      <dc:creator>eer_seer</dc:creator>
      <dc:date>2018-08-01T13:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Order of Class Variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/483075#M71689</link>
      <description>&lt;P&gt;This was a great and simple solution to the problem and worked just as you described.&amp;nbsp; Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Aug 2018 13:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Order-of-Class-Variable/m-p/483075#M71689</guid>
      <dc:creator>eer_seer</dc:creator>
      <dc:date>2018-08-01T13:51:51Z</dc:date>
    </item>
  </channel>
</rss>

