<?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: Why my format statement does not work properly in proc means? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734718#M228872</link>
    <description>&lt;P&gt;The reason the FORMAT statement has no effect:&amp;nbsp; PROC MEANS is not printing TOT_ASS.&amp;nbsp; Instead, it is printing values that were calculated from TOT_ASS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Luckily, several procedures are capable of printing summary statistics.&amp;nbsp; For example, PROC TABULATE can do that, and it is much more capable when it comes to formatting.&amp;nbsp; For example, here is some untested code that you can play with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=have noseps;
var tot_ass;
tables n='N:' * F=comma7.
       mean='Mean:' * f=dollar15.2
       median='Median:' * f = dollar15.2
       min='Minimum:' * f=dollar15.2
       max='Maximum:' * f=dollar15.2
       ,
       tot_ass;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may need to play around with the table (such as adjusting the formats, or removing the NOSEPS option) to improve its appearance.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Apr 2021 13:20:19 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2021-04-16T13:20:19Z</dc:date>
    <item>
      <title>Why my format statement does not work properly in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734654#M228842</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to do a summary statistic, I want to have a dollar format but when I code, it does not work properly. My code is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data= merge_treat_con n nmiss mean median std min max ;
var TOT_ASS;
format tot_ass dollar10.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The result is&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Phil_NZ_0-1618548668284.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58103i4263CF5DEDEB24EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Phil_NZ_0-1618548668284.png" alt="Phil_NZ_0-1618548668284.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;What I want is the below display:&lt;/P&gt;
&lt;P&gt;N: 315,644&lt;/P&gt;
&lt;P&gt;Mean:$1,644,563.48&lt;/P&gt;
&lt;P&gt;Median:$151,294.00&lt;/P&gt;
&lt;P&gt;Minimum:$0&lt;/P&gt;
&lt;P&gt;Maximum: $781,818,000&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While I try the code below, it announces errors&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data= merge_treat_con n nmiss mean median std min max;
	var TOT_ASS;
	format tot_ass dollar10.2 N comma7. Mean median dollar10.2
		minimum maximum dollar11.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;34         proc means data= merge_treat_con n nmiss mean median std min max ;
35         var TOT_ASS;
36         format tot_ass dollar10.2 N comma7. Mean median dollar10.2
WARNING: Variable N not found in data set WORK.MERGE_TREAT_CON.
37         minimum maximum dollar11.2;
WARNING: Variable MEAN not found in data set WORK.MERGE_TREAT_CON.
WARNING: Variable MEDIAN not found in data set WORK.MERGE_TREAT_CON.
WARNING: Variable MINIMUM not found in data set WORK.MERGE_TREAT_CON.
WARNING: Variable MAXIMUM not found in data set WORK.MERGE_TREAT_CON.
38         run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you please help me to sort it out?&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 04:57:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734654#M228842</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-04-16T04:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why my format statement does not work properly in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734669#M228847</link>
      <description>&lt;P&gt;The format-statement has no effect on the variables created by proc means.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 07:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734669#M228847</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-16T07:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why my format statement does not work properly in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734671#M228849</link>
      <description>&lt;P&gt;Run next code and add any reporting step or procedure:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data= sashelp.class noprint
            n nmiss mean median std min max ;
var height;
output out=temp (keep=_STAT_ height);
run;

proc transpose data=temp out=tmp1;
var height;
ID  _stat_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Apr 2021 08:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734671#M228849</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-04-16T08:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Why my format statement does not work properly in proc means?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734718#M228872</link>
      <description>&lt;P&gt;The reason the FORMAT statement has no effect:&amp;nbsp; PROC MEANS is not printing TOT_ASS.&amp;nbsp; Instead, it is printing values that were calculated from TOT_ASS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Luckily, several procedures are capable of printing summary statistics.&amp;nbsp; For example, PROC TABULATE can do that, and it is much more capable when it comes to formatting.&amp;nbsp; For example, here is some untested code that you can play with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=have noseps;
var tot_ass;
tables n='N:' * F=comma7.
       mean='Mean:' * f=dollar15.2
       median='Median:' * f = dollar15.2
       min='Minimum:' * f=dollar15.2
       max='Maximum:' * f=dollar15.2
       ,
       tot_ass;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may need to play around with the table (such as adjusting the formats, or removing the NOSEPS option) to improve its appearance.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 13:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-my-format-statement-does-not-work-properly-in-proc-means/m-p/734718#M228872</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-04-16T13:20:19Z</dc:date>
    </item>
  </channel>
</rss>

