<?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 to create multiple by tables -how to control order of tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-to-create-multiple-by-tables-how-to-control-order/m-p/636896#M189283</link>
    <description>&lt;P&gt;Proc Tabulate is going to need some help from you to create custom orders.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either you have to sort the data prior to the procedure and use the ORDER=DATA option or&lt;/P&gt;
&lt;P&gt;1) create a new numeric variable for the order you want something to appear,&lt;/P&gt;
&lt;P&gt;2) create a format to show that numeric variable with the desired text&lt;/P&gt;
&lt;P&gt;3) use order= unformatted&lt;/P&gt;
&lt;P&gt;OR you may be able to create a custom format for the class variable(s) in the desired order and the PRELOADFMT option. which may have other issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Showing a statistic in millions will require 1) a custom format, there is an example in Proc Format documentation and you apply a format by something like:&lt;/P&gt;
&lt;PRE&gt;      invoice=''*sum='Sum'*f=formatname. &lt;/PRE&gt;
&lt;P&gt;if you miss the *f= before the format name you will get syntax errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on the specific actual data some of this may be accomplished by pre_summarizing the data with Proc summary as you can get "totals" of the class variables in combination and use _type_ to control the ones you want for a table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not even going to touch the Excel side by side&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The option I showed yesterday using ORIGIN as a CLASS variable and in a Page expression will place a "title" before each table that looks like "Origin &amp;lt;origin value&amp;gt;" . By providing a more interesting label to the variable as an override you can get a custom "title"&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.cars;
class make;
class origin;
var invoice;
table origin=[Label="Area of origin is: " style=[background=yellow] ],
      make ALL='TOTAL'  ,
      invoice=''*sum='Sum';
Run;&lt;/PRE&gt;</description>
    <pubDate>Thu, 02 Apr 2020 15:31:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-02T15:31:18Z</dc:date>
    <item>
      <title>proc tabulate to create multiple by tables -how to control order of tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-to-create-multiple-by-tables-how-to-control-order/m-p/636813#M189245</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am using proc tabulate to create multiple summary tables (For each category of&amp;nbsp; variable "origin" I create a separate summary table).&lt;/P&gt;
&lt;P&gt;I would like to modify the code in order to create few requests:&lt;/P&gt;
&lt;P&gt;1-I want that the order of the tables will be by the 'Total' of each table (So the order of the tables should be&amp;nbsp; 'Europe'&amp;nbsp; , 'USA' ,'Asia')&lt;/P&gt;
&lt;P&gt;2-I want to export the tables to one excel file and put the tables side by side of each other&lt;/P&gt;
&lt;P&gt;3-For each table I want to have a title with origin information with yellow background&lt;/P&gt;
&lt;P&gt;4-I want to display the values of&amp;nbsp; invoice sum by millions of $&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sort data=sashelp.cars out=cars;
by origin;
run;

proc tabulate data=cars;
class make;
by origin;
var invoice;
table make ALL='TOTAL'  ,invoice=SUM;
Run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;thanks for your advice&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;</description>
      <pubDate>Thu, 02 Apr 2020 09:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-to-create-multiple-by-tables-how-to-control-order/m-p/636813#M189245</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-04-02T09:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate to create multiple by tables -how to control order of tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-to-create-multiple-by-tables-how-to-control-order/m-p/636896#M189283</link>
      <description>&lt;P&gt;Proc Tabulate is going to need some help from you to create custom orders.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either you have to sort the data prior to the procedure and use the ORDER=DATA option or&lt;/P&gt;
&lt;P&gt;1) create a new numeric variable for the order you want something to appear,&lt;/P&gt;
&lt;P&gt;2) create a format to show that numeric variable with the desired text&lt;/P&gt;
&lt;P&gt;3) use order= unformatted&lt;/P&gt;
&lt;P&gt;OR you may be able to create a custom format for the class variable(s) in the desired order and the PRELOADFMT option. which may have other issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Showing a statistic in millions will require 1) a custom format, there is an example in Proc Format documentation and you apply a format by something like:&lt;/P&gt;
&lt;PRE&gt;      invoice=''*sum='Sum'*f=formatname. &lt;/PRE&gt;
&lt;P&gt;if you miss the *f= before the format name you will get syntax errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on the specific actual data some of this may be accomplished by pre_summarizing the data with Proc summary as you can get "totals" of the class variables in combination and use _type_ to control the ones you want for a table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not even going to touch the Excel side by side&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The option I showed yesterday using ORIGIN as a CLASS variable and in a Page expression will place a "title" before each table that looks like "Origin &amp;lt;origin value&amp;gt;" . By providing a more interesting label to the variable as an override you can get a custom "title"&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.cars;
class make;
class origin;
var invoice;
table origin=[Label="Area of origin is: " style=[background=yellow] ],
      make ALL='TOTAL'  ,
      invoice=''*sum='Sum';
Run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Apr 2020 15:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-to-create-multiple-by-tables-how-to-control-order/m-p/636896#M189283</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-02T15:31:18Z</dc:date>
    </item>
  </channel>
</rss>

