<?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 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59369#M16758</link>
    <description>My apologies for wasting anyones time.  I have finally worked it out.&lt;BR /&gt;
&lt;BR /&gt;
By using the "order = data" option within the class statement the variable month is produced in the same order as the dataset to which it is based upon.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.</description>
    <pubDate>Tue, 04 Nov 2008 03:01:04 GMT</pubDate>
    <dc:creator>Scottcom4</dc:creator>
    <dc:date>2008-11-04T03:01:04Z</dc:date>
    <item>
      <title>Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59368#M16757</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I am attempting to create a table using proc tabs with Year and Month as the 2 classification variables.  The thing is that I want to have Month in the correct calender order, however they appear in alphabetic order.&lt;BR /&gt;
&lt;BR /&gt;
All I have been able to do so far is create a format with Month shown as 01 January for example.  I would much rather not show the 01 if possible.&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any other ideas/solutions?&lt;BR /&gt;
&lt;BR /&gt;
Regards, &lt;BR /&gt;
&lt;BR /&gt;
Scott</description>
      <pubDate>Tue, 04 Nov 2008 00:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59368#M16757</guid>
      <dc:creator>Scottcom4</dc:creator>
      <dc:date>2008-11-04T00:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59369#M16758</link>
      <description>My apologies for wasting anyones time.  I have finally worked it out.&lt;BR /&gt;
&lt;BR /&gt;
By using the "order = data" option within the class statement the variable month is produced in the same order as the dataset to which it is based upon.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.</description>
      <pubDate>Tue, 04 Nov 2008 03:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59369#M16758</guid>
      <dc:creator>Scottcom4</dc:creator>
      <dc:date>2008-11-04T03:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59370#M16759</link>
      <description>I don't like using order = data because I cannot always control all the class variables, and the default is at least consistent. Default ORDER= is internal, even though it shows and sums by the formatted value.&lt;BR /&gt;
So, for month, store the full date value with monname. format. &lt;BR /&gt;
A solution for year is less important, but the year4. format provides consistency. &lt;BR /&gt;
Unfortunately TABULATE cannot use the same class variable with two different formats so you need that extra variable.&lt;BR /&gt;
Here's a demo using sashelp.prdsal2[pre]data prdsal2/ view=prdsal2 ;                        &lt;BR /&gt;
  set sashelp.prdsal2 ;               &lt;BR /&gt;
  if ranuni(1) &amp;gt; .2 ;                 &lt;BR /&gt;
  mon = monyr;                        &lt;BR /&gt;
  yr  = mon  ;                        &lt;BR /&gt;
run;                                  &lt;BR /&gt;
proc tabulate missing noseps ;        &lt;BR /&gt;
 class   mon yr ;                     &lt;BR /&gt;
 format  mon monname.  yr year4. ;    &lt;BR /&gt;
 var     actual ;                     &lt;BR /&gt;
 table  (all mon all ), (all  yr all )&lt;BR /&gt;
   * n=' '*f= 5. / rts= 12 box='N' ;  &lt;BR /&gt;
run;                        [/pre]which provided this sumary in the listing window[pre]------------------------------------------------&lt;BR /&gt;
|N         |     |          yr           |     |&lt;BR /&gt;
|          |     |-----------------------|     |&lt;BR /&gt;
|          | All |1995 |1996 |1997 |1998 | All |&lt;BR /&gt;
|----------+-----+-----+-----+-----+-----+-----|&lt;BR /&gt;
|All       |18501| 4676| 4576| 4620| 4629|18501|&lt;BR /&gt;
|mon       |     |     |     |     |     |     |&lt;BR /&gt;
|January   | 1557|  384|  397|  388|  388| 1557|&lt;BR /&gt;
|February  | 1520|  375|  379|  386|  380| 1520|&lt;BR /&gt;
|March     | 1549|  390|  382|  399|  378| 1549|&lt;BR /&gt;
|April     | 1545|  397|  382|  384|  382| 1545|&lt;BR /&gt;
|May       | 1533|  398|  356|  390|  389| 1533|&lt;BR /&gt;
|June      | 1554|  400|  389|  382|  383| 1554|&lt;BR /&gt;
|July      | 1544|  396|  371|  389|  388| 1544|&lt;BR /&gt;
|August    | 1523|  395|  377|  370|  381| 1523|&lt;BR /&gt;
|September | 1557|  386|  396|  388|  387| 1557|&lt;BR /&gt;
|October   | 1547|  383|  382|  388|  394| 1547|&lt;BR /&gt;
|November  | 1522|  391|  380|  377|  374| 1522|&lt;BR /&gt;
|December  | 1550|  381|  385|  379|  405| 1550|&lt;BR /&gt;
|All       |18501| 4676| 4576| 4620| 4629|18501|&lt;BR /&gt;
------------------------------------------------[/pre]&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 04 Nov 2008 15:03:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59370#M16759</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-11-04T15:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59371#M16760</link>
      <description>Thanks Peter.&lt;BR /&gt;
&lt;BR /&gt;
The output is as desired, but I am unsure how you are are getting the desired order.</description>
      <pubDate>Tue, 04 Nov 2008 22:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59371#M16760</guid>
      <dc:creator>Scottcom4</dc:creator>
      <dc:date>2008-11-04T22:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59372#M16761</link>
      <description>the default is order=internal&lt;BR /&gt;
 &lt;BR /&gt;
The following is a bit like over stating the issue......&lt;BR /&gt;
The internal values are traditional SAS date= number of days since 1960, &lt;BR /&gt;
so the months of a year are ascending.&lt;BR /&gt;
The summarising uses formatted values so the rows are summarised by the monname. format.&lt;BR /&gt;
that's all&lt;BR /&gt;
 &lt;BR /&gt;
The important feature where TABULATE is adding value, is the distinction between internal value (for ordering) and formatted value (for presentation)&lt;BR /&gt;
&lt;BR /&gt;
just mho&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 05 Nov 2008 10:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate/m-p/59372#M16761</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2008-11-05T10:29:47Z</dc:date>
    </item>
  </channel>
</rss>

