<?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: apply a number format to a count of a character variable in proc Report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/290272#M16597</link>
    <description>&lt;P&gt;thank you so much, I was not aware i could force 1 column with the style clause like that. I have to read up on it.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2016 18:19:37 GMT</pubDate>
    <dc:creator>sasiscool</dc:creator>
    <dc:date>2016-08-08T18:19:37Z</dc:date>
    <item>
      <title>apply a number format to a count of a character variable in proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289286#M16564</link>
      <description>&lt;P&gt;If I have code that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=work.test;&lt;BR /&gt;column dinner&amp;nbsp;Year&lt;/P&gt;&lt;P&gt;define dinner / group &amp;nbsp;f=$diner. ' ';&lt;/P&gt;&lt;P&gt;define year/across ' ' ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and produce a report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2001 &amp;nbsp; &amp;nbsp; &amp;nbsp;2002 &amp;nbsp; &amp;nbsp; &amp;nbsp;2003&lt;/P&gt;&lt;P&gt;Tim's &amp;nbsp; &amp;nbsp;90 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1000 &amp;nbsp; &amp;nbsp; &amp;nbsp; 2312 &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ferris' &amp;nbsp; 19 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;89&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to format the numbers to appear with commas, such as in the classics f=comma8. However, diner is a character variable, and unfortunately year is as well. Is there any way to apply number formats to counts of character variables, without having to convert the base variables to numeric?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 17:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289286#M16564</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2016-08-03T17:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: apply a number format to a count of a character variable in proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289402#M16570</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** make data into thousands;
** to use comma format;
data heart;
  set sashelp.heart;
  output; 
  output;
run;
   
proc report data=heart;
  column chol_status n,bp_status ;
  define chol_status / group;
  define bp_status / across;
  define n / 'Count' f=comma6.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Yes, if you explicitly use the N statistic in the report, you can format the number. for example, see the results below.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4425i83191FF7CA0766FE/image-size/original?v=v2&amp;amp;px=-1" alt="comma_format.png" title="comma_format.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; &lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 00:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289402#M16570</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-08-04T00:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: apply a number format to a count of a character variable in proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289553#M16578</link>
      <description>Thanks for replying Cynthia.&lt;BR /&gt;&lt;BR /&gt;That is how I used to have it, but it then it gives me two rows as headers, and the first cell is merged. This is a part of an ODS to excel, and I need to have the first row of across variables be in one row.&lt;BR /&gt;&lt;BR /&gt;I think it is just a trade off, either manual work to changed the numbers to the correct format in excel, or manual work deleting rows to ensure I only have one. Oh well.</description>
      <pubDate>Thu, 04 Aug 2016 14:32:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289553#M16578</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2016-08-04T14:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: apply a number format to a count of a character variable in proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289597#M16581</link>
      <description>&lt;P&gt;If you do not need the Proc Report ability to calculate from other column results this &lt;STRONG&gt;may&lt;/STRONG&gt; be possible with Proc Tabulate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I understand what you are attempting this may work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=work.test;
   class year dinner;
   format dinner $diner.;
   table dinner='', /* the ='' suppresses the variable or statistic label*/
         year=''*n=''*f=comma8.&lt;BR /&gt;   ; /* the *f=comma8. says to apply the comma8. format to the n statistic*/
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is also an option available that would put a column header in the empty box above the dinner variable. Amazingly that option is BOX and would go before the semicolon ending the TABLE statement. Somelike&amp;nbsp; / BOX="some text";&amp;nbsp; The / is to indicate the start of table options. Or /Box=Dinner would place the label or variable name for dinner there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 17:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289597#M16581</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-04T17:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: apply a number format to a count of a character variable in proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289680#M16583</link>
      <description>&lt;P&gt;you can get rid of all those headers. Consider this change to the DEFINE statements:&lt;BR /&gt;&lt;BR /&gt; define bp_status / ' ' across;&lt;BR /&gt; define n / ' ' f=comma6.;&lt;BR /&gt;&lt;BR /&gt;That should leave you with just one column header row.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;BR /&gt; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above would work for HTML or RTF or PDF, but for EXCELXP or ODS EXCEL, you'd need to use TAGATTR to get the commas:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4439i63B4502CC91EA17A/image-size/original?v=v2&amp;amp;px=-1" alt="one_header.png" title="one_header.png" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 22:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/289680#M16583</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-08-04T22:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: apply a number format to a count of a character variable in proc Report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/290272#M16597</link>
      <description>&lt;P&gt;thank you so much, I was not aware i could force 1 column with the style clause like that. I have to read up on it.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2016 18:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/apply-a-number-format-to-a-count-of-a-character-variable-in-proc/m-p/290272#M16597</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2016-08-08T18:19:37Z</dc:date>
    </item>
  </channel>
</rss>

