<?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 Wrong Format in Output File in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939456#M83610</link>
    <description>&lt;P&gt;The Format= option on the Proc statement is not applied to variables in the resulting data set as you have found out. The output data set created variables are assigned BEST12 formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could either a assign a desired format when using the variables in any other procedure or use Proc Datasets to change the default. Something like:&lt;/P&gt;
&lt;PRE&gt;Proc datasets library=work;
   modify out_example ;
      format  var1_mean var2_mean var3_mean 20.15;
   run;
quit;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2024 15:21:57 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-08-15T15:21:57Z</dc:date>
    <item>
      <title>Proc Tabulate Wrong Format in Output File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939452#M83608</link>
      <description>&lt;P&gt;I am using SAS EG 7.1. The variables that I tabulating have a lot of zeros after the decimal point and I would like to see all decimal points until the first non-zero digit. So I use the format option. The format works fine in the results window. However the output file still shows the scientific notation (e.g. 1.6E-07). How can I make sure the the results and output file have the same format? &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc tabulate data=example out=out_example (drop=_:) format=20.15;
class year;
var          var1 var2 var3;
table year, (var1 var2 var3)*(mean) (N);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Aug 2024 14:59:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939452#M83608</guid>
      <dc:creator>trevand</dc:creator>
      <dc:date>2024-08-15T14:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Wrong Format in Output File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939454#M83609</link>
      <description>&lt;P&gt;Run &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1hmips60w5w3yn1hj9klna7aplw.htm" target="_blank" rel="noopener"&gt;PROC DATASETS&lt;/A&gt; with a &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0ahh0eqtadmp3n1uwv55i2gyxiz.htm" target="_blank" rel="noopener"&gt;MODIFY&lt;/A&gt; and &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n09nl7f8smat49n1rz1rav5i6a8a.htm" target="_blank" rel="noopener"&gt;FORMAT&lt;/A&gt; statement.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 15:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939454#M83609</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-15T15:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Wrong Format in Output File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939456#M83610</link>
      <description>&lt;P&gt;The Format= option on the Proc statement is not applied to variables in the resulting data set as you have found out. The output data set created variables are assigned BEST12 formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could either a assign a desired format when using the variables in any other procedure or use Proc Datasets to change the default. Something like:&lt;/P&gt;
&lt;PRE&gt;Proc datasets library=work;
   modify out_example ;
      format  var1_mean var2_mean var3_mean 20.15;
   run;
quit;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 15:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939456#M83610</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-15T15:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate Wrong Format in Output File</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939457#M83611</link>
      <description>&lt;P&gt;If the goal is to make a dataset why use PROC TABULATE?&lt;/P&gt;
&lt;P&gt;Use PROC SUMMARY and the formats attached to the variables are carried onto the statistics.&amp;nbsp; You can even attach formats to the output statistics, but you could get a warning.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=sashelp.class out=out_example (drop=_:) ;
  class sex;
  var age height weight ;
  table sex, (age height weight)*(mean*F=7.3) (N*F=7.);
run;

proc contents data=out_example;
run;

proc summary data=sashelp.class nway ;
  class sex;
  var age height weight ;
  output out=out_example2(drop=_type_ rename=(_freq_=N)) mean= / autoname;
  format age 7.3 ;
  format N 7.;
run;

proc contents data=out_example2;
run;

proc compare data=out_example compare=out_example2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 15:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Wrong-Format-in-Output-File/m-p/939457#M83611</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-15T15:22:09Z</dc:date>
    </item>
  </channel>
</rss>

