<?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 comma format in proc report in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621756#M77248</link>
    <description>&lt;P&gt;How should I change my code? The first one works while the second one doesn't. Like the second code, I would like to get the reported numbers formatted with comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
	*It works;
	proc report data= sashelp.heart missing;
		column status sex, n;
		define status/ group;
		define sex/ across; run;

	*It doesn' work.;
	proc report data= sashelp.heart missing;
		column status sex, n;
		define status/ group;
		define sex/ across format= comma9.2; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 02 Feb 2020 13:15:23 GMT</pubDate>
    <dc:creator>braam</dc:creator>
    <dc:date>2020-02-02T13:15:23Z</dc:date>
    <item>
      <title>comma format in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621756#M77248</link>
      <description>&lt;P&gt;How should I change my code? The first one works while the second one doesn't. Like the second code, I would like to get the reported numbers formatted with comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
	*It works;
	proc report data= sashelp.heart missing;
		column status sex, n;
		define status/ group;
		define sex/ across; run;

	*It doesn' work.;
	proc report data= sashelp.heart missing;
		column status sex, n;
		define status/ group;
		define sex/ across format= comma9.2; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Feb 2020 13:15:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621756#M77248</guid>
      <dc:creator>braam</dc:creator>
      <dc:date>2020-02-02T13:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: comma format in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621757#M77249</link>
      <description>&lt;P&gt;You want to put commas in the variable SEX? I am not understanding this.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 13:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621757#M77249</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-02T13:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: comma format in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621758#M77250</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;P&gt;This is what I get from the first code.&lt;/P&gt;
&lt;TABLE class="table" summary="Procedure Report: Detailed and/or summarized report" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="c header" colspan="2" scope="colgroup"&gt;Sex&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;Female&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;Male&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;Status&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Alive&lt;/TD&gt;
&lt;TD class="r data"&gt;1977&lt;/TD&gt;
&lt;TD class="r data"&gt;1241&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Dead&lt;/TD&gt;
&lt;TD class="r data"&gt;896&lt;/TD&gt;
&lt;TD class="r data"&gt;
&lt;P&gt;1095&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I would like to get.&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Report: Detailed and/or summarized report" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="c header" colspan="2" scope="colgroup"&gt;Sex&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;Female&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;Male&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="c header" scope="col"&gt;Status&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;TH class="c header" scope="col"&gt;n&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Alive&lt;/TD&gt;
&lt;TD class="r data"&gt;1,977&lt;/TD&gt;
&lt;TD class="r data"&gt;1,241&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;Dead&lt;/TD&gt;
&lt;TD class="r data"&gt;896&lt;/TD&gt;
&lt;TD class="r data"&gt;1,095&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sun, 02 Feb 2020 13:35:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621758#M77250</guid>
      <dc:creator>braam</dc:creator>
      <dc:date>2020-02-02T13:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: comma format in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621762#M77251</link>
      <description>&lt;P&gt;So you want the comma in the value of N, not in the value of SEX as originally implied by your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not know if there is a way to format a statistic like N in the column statement. However, it is possible to format N in the CALL DEFINE statement, but you have to compute the statistic N for a specific variable, such as AGEATSTART (or any other variable you'd like to use)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data= sashelp.heart missing;
	column ("Status" status) sex, ageatstart;
	define status/ group ' ';
	define sex/ across; 
	define ageatstart/n ' ';
	compute ageatstart;
            call define(_col_,'format',"comma8.0");
        endcompute;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 14:00:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621762#M77251</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-02T14:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: comma format in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621775#M77252</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279507"&gt;@braam&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The sex variable cannot have the format comma9.2 for its modalities.&lt;/P&gt;
&lt;P&gt;You need to add as statement for "n" to apply this format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	proc report data= sashelp.heart missing;
		column status sex, n;
		define status/ group;
		define sex/ across;
		define n /  format= comma9.2;
	run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Feb 2020 15:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621775#M77252</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-02-02T15:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: comma format in proc report</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621787#M77253</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You can't supply a numeric format for a character variable. You want to format the N statistics that is being placed UNDER the value of the SEX variable in the output table. Call Define is one approach. An even simpler approach is to use the format= or f= in a DEFINE statement for the N statistic, as shown below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="format_define.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35807iB1D8D18CB8B55CB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="format_define.png" alt="format_define.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Sun, 02 Feb 2020 17:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/comma-format-in-proc-report/m-p/621787#M77253</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-02-02T17:21:21Z</dc:date>
    </item>
  </channel>
</rss>

