<?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 Tabulate customize order in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389575#M66060</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Current Output.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14570i13016D89C8490506/image-size/large?v=v2&amp;amp;px=999" role="button" title="Current Output.png" alt="Current Output.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desired output.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14571i3EDAC69559CB0393/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired output.png" alt="desired output.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have scowered resources and board posts but can't find something to fit my needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing a PROC TABULATE code to print a table with each data set that has an identical structure, irrespective of the data being output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one variable and four classes: Yields (var 'ym_yld_a') by BOPKEYSECTOR &amp;gt; by provinces &amp;gt; by currencies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need ALL currencies to be part of the table, even if my output doesnt produce data for a given currency.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;- it is very simple&lt;/P&gt;&lt;P&gt;- i have tried variations in the ORDER= to make all currencies to be printed even with missing values, but no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know if this is something can be done?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Ive added two photos: 1) what I currently get, usually. 2) the format I want printed, and populated with whatever data is being derived by the program.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;THANKS! &lt;/EM&gt;I will continue to work on this but any help is tremendous!&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;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC TABULATE
DATA=YM.TG_POS_200805_S7;

	FORMAT=BEST12.;
	VAR YM_YLD_A;
	CLASS RTTM_INT /	ORDER=UNFORMATTED ;
	CLASS BOPKEY_SECTOR /	ORDER=UNFORMATTED;
	CLASS province /	ORDER=UNFORMATTED;
	CLASS CURR /	ORDER= UNFORMATTED; 
	
	TABLE 
		/* ROW Statement */
		BOPKEY_SECTOR *province *CURR  ,
		/* COLUMN Statement */
		RTTM_INT *(YM_YLD_A * Sum={LABEL="Sum"} );
		
	;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 21 Aug 2017 16:20:28 GMT</pubDate>
    <dc:creator>KG2</dc:creator>
    <dc:date>2017-08-21T16:20:28Z</dc:date>
    <item>
      <title>Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389575#M66060</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Current Output.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14570i13016D89C8490506/image-size/large?v=v2&amp;amp;px=999" role="button" title="Current Output.png" alt="Current Output.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="desired output.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14571i3EDAC69559CB0393/image-size/large?v=v2&amp;amp;px=999" role="button" title="desired output.png" alt="desired output.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have scowered resources and board posts but can't find something to fit my needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing a PROC TABULATE code to print a table with each data set that has an identical structure, irrespective of the data being output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one variable and four classes: Yields (var 'ym_yld_a') by BOPKEYSECTOR &amp;gt; by provinces &amp;gt; by currencies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need ALL currencies to be part of the table, even if my output doesnt produce data for a given currency.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;- it is very simple&lt;/P&gt;&lt;P&gt;- i have tried variations in the ORDER= to make all currencies to be printed even with missing values, but no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know if this is something can be done?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Ive added two photos: 1) what I currently get, usually. 2) the format I want printed, and populated with whatever data is being derived by the program.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;THANKS! &lt;/EM&gt;I will continue to work on this but any help is tremendous!&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;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC TABULATE
DATA=YM.TG_POS_200805_S7;

	FORMAT=BEST12.;
	VAR YM_YLD_A;
	CLASS RTTM_INT /	ORDER=UNFORMATTED ;
	CLASS BOPKEY_SECTOR /	ORDER=UNFORMATTED;
	CLASS province /	ORDER=UNFORMATTED;
	CLASS CURR /	ORDER= UNFORMATTED; 
	
	TABLE 
		/* ROW Statement */
		BOPKEY_SECTOR *province *CURR  ,
		/* COLUMN Statement */
		RTTM_INT *(YM_YLD_A * Sum={LABEL="Sum"} );
		
	;

RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Aug 2017 16:20:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389575#M66060</guid>
      <dc:creator>KG2</dc:creator>
      <dc:date>2017-08-21T16:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389584#M66062</link>
      <description>&lt;P&gt;Relating to your info:&lt;/P&gt;
&lt;PRE&gt;I have one variable and four classes ...
 
I need ALL currencies to be part of the table, even if my output doesnt produce data for a given currency.&lt;/PRE&gt;
&lt;P&gt;Crteate a skeleton table with all class variables and all need values (including those that are absent or missing)&lt;/P&gt;
&lt;P&gt;then merge it with your data. Add option missing to proc tabulate statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have issues, post your new full code and show what are your issues.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 16:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389584#M66062</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-08-21T16:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389585#M66063</link>
      <description>&lt;P&gt;Without data I am guessing that you want some level of a class variable to appear when there is no data. The basic way to do that with proc tabulate is to have a format for the class variable that includes all of the levels for the variable and use the PRELOADFMT option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a relatively trivial example:&lt;/P&gt;
&lt;PRE&gt;data have;
   do x= 1,2,4;
   output;
   end;
run;

proc format library=work cntlout=work.cntl;
value x
   1 = '1'
   2 = '2'
   3 = '3'
   4 = '4'
;
run;

proc tabulate data=have;
   class x /preloadfmt ;
   format x x.;
   table x, 
         n
        /printmiss;
run;&lt;/PRE&gt;
&lt;P&gt;for preloadfmt to display you need either order=data or the printmiss option for the table or the class option exclusive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 17:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389585#M66063</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-21T17:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389586#M66064</link>
      <description>&lt;P&gt;Thank you, I am going to work on that a bit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was just adding the preloadfmt actually! Lets hope it works,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Aug 2017 17:08:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389586#M66064</guid>
      <dc:creator>KG2</dc:creator>
      <dc:date>2017-08-21T17:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389800#M66076</link>
      <description>&lt;PRE&gt;
Do not forget CLASSDATA= option of PROC TABULATE .


&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Aug 2017 13:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389800#M66076</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-22T13:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389841#M66077</link>
      <description>&lt;P&gt;Thank you, But I have to ask.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After getting SAS to PROC TABULATE CLASS=CURR, all of them, is it possible to also tell says that I want them in a specific order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example (1) CAN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (2) USA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (3) EUR&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently it will do it alphabetically but it is very important to me that CAN is&amp;nbsp;the first,&amp;nbsp;because it is my underlying. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am experimenting but I am not sure if there is some sort of instatement available in the CLASS = or ORDER=.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 14:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/389841#M66077</guid>
      <dc:creator>KG2</dc:creator>
      <dc:date>2017-08-22T14:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/390027#M66095</link>
      <description>&lt;P&gt;If you can sort the data before the procedure then ORDER=data on the class may help.&lt;/P&gt;
&lt;P&gt;another option is to not use character variables but a numeric variable with a custom format to display the desired text and then either sort the data by the numeric and use order=unformatted.&lt;/P&gt;
&lt;PRE&gt;data have;
   do x= 1,2,4,0;
   output;
   end;
run;

proc format library=work cntlout=work.cntl;
value x   (notsorted)
   1 = 'AUS'
   2 = 'FRA'
   3 = 'DDR'
   4 = 'MEX'
   0 = 'Can'
;
run;

proc tabulate data=have ;
   class x /preloadfmt order=unformatted;
   format x x.;
   table x, 
         n
        /printmiss;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Aug 2017 20:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/390027#M66095</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-22T20:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate customize order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/390194#M66111</link>
      <description>&lt;PRE&gt;
You could PAD some white blank before CAN. Here is an example:


proc tabulate data=sashelp.class;
class sex;
var age;
table sex,age;
run;

data class;
 length sex $ 4;
 set sashelp.class;
 if sex='M' then sex='   M';
run;
proc tabulate data=class;
class sex;
var age;
table sex,age;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Aug 2017 12:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-customize-order/m-p/390194#M66111</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-23T12:17:09Z</dc:date>
    </item>
  </channel>
</rss>

