<?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 How to put a comma in the numbers of the output in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268899#M53271</link>
    <description>&lt;P&gt;i know there is put statement, that can add "," to the number, thus, 2378912 can be changed to 2378,912&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PUT INCOME2 comma8.2;&lt;/P&gt;
&lt;P&gt;variable Number and percent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;expect, number will be like, 1234,569&lt;/P&gt;
&lt;P&gt;percent will be like, 0.63&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my question is I am not using proc sql, nor any data steps. I am using proc freq and hope the output be like 2378,129 instead of 2378129&lt;/P&gt;
&lt;P&gt;since the code will be&lt;/P&gt;
&lt;P&gt;proc freq,&lt;/P&gt;
&lt;P&gt;proc print&lt;/P&gt;
&lt;P&gt;I do not know where I can put commax statement, or how to change the format of numbers, to add "," to the total number, but without dicimal, 2378,129 not 2378,129.0. however, in the same output, i want to the percent will be 0.63&lt;/P&gt;
&lt;P&gt;would anybody provide a sample code?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2017 17:17:15 GMT</pubDate>
    <dc:creator>Bal23</dc:creator>
    <dc:date>2017-10-10T17:17:15Z</dc:date>
    <item>
      <title>How to put a comma in the numbers of the output</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268899#M53271</link>
      <description>&lt;P&gt;i know there is put statement, that can add "," to the number, thus, 2378912 can be changed to 2378,912&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PUT INCOME2 comma8.2;&lt;/P&gt;
&lt;P&gt;variable Number and percent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;expect, number will be like, 1234,569&lt;/P&gt;
&lt;P&gt;percent will be like, 0.63&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my question is I am not using proc sql, nor any data steps. I am using proc freq and hope the output be like 2378,129 instead of 2378129&lt;/P&gt;
&lt;P&gt;since the code will be&lt;/P&gt;
&lt;P&gt;proc freq,&lt;/P&gt;
&lt;P&gt;proc print&lt;/P&gt;
&lt;P&gt;I do not know where I can put commax statement, or how to change the format of numbers, to add "," to the total number, but without dicimal, 2378,129 not 2378,129.0. however, in the same output, i want to the percent will be 0.63&lt;/P&gt;
&lt;P&gt;would anybody provide a sample code?&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 17:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268899#M53271</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2017-10-10T17:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268901#M53273</link>
      <description>&lt;P&gt;For your &lt;STRONG&gt;variable&lt;/STRONG&gt; values use a FORMAT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc freq data=have;
&amp;nbsp;&amp;nbsp; tables income;
&amp;nbsp;&amp;nbsp; format income Comma8.2;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or similar in proc print or just about any procedure that displays your variabls in the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to change the appearance of values calculated by the procedure, such as the count or percent in Proc Freq,&amp;nbsp;then you will have to customize the table template the procedure uses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternative from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;that uses PROC TABULATE:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Here's sample code using comma and dollar format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;tabulate&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;sashelp&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;prdsal2&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;title&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'Total Sales, By Quarter and Country'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;class&lt;/SPAN&gt; country quarter&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;var&lt;/SPAN&gt; predict&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;country&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;''&lt;/SPAN&gt; all&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Global'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; 
  quarter&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;''&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;predict&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;''&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Sum'&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;f&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;dollar12&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'Count'&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;f&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;comma12&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/LI-CODE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 10 Oct 2017 17:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268901#M53273</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-10T17:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268908#M53274</link>
      <description>&lt;P&gt;Use proc tabulate for the output, it allows you to control the format in the output. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2016 20:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268908#M53274</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-06T20:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268939#M53275</link>
      <description>&lt;P&gt;Here's sample code using comma and dollar format.&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=sashelp.prdsal2;
title 'Total Sales, By Quarter and Country';
class country quarter;
var predict;
table (country='' all='Global'), 
  quarter=''*predict=''*(sum='Sum'*f=dollar12.2 n='Count'*f=comma12.);
run;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2017 17:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/268939#M53275</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-10T17:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269517#M53418</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884" target="_self"&gt;&lt;SPAN class="login-bold"&gt;ballardw&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;this does not work.&lt;/P&gt;&lt;P&gt;ERROR: You are trying to use the numeric format COMMA with the character variable gainage in data&lt;/P&gt;&lt;P&gt;set WORK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 17:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269517#M53418</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-05-10T17:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269519#M53419</link>
      <description>&lt;P&gt;You have to convert your variable to a numeric type if you want to apply a numeric format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use INPUT() function to do so.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 17:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269519#M53419</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-10T17:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269520#M53420</link>
      <description>&lt;P&gt;You cannot apply a numeric format to a character variable. &amp;nbsp;You need to convert it to a number first.&lt;/P&gt;
&lt;P&gt;You might want to add a step where you convert gainage to a number and then store the result back.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;gainage=put(input(strip(gainage),32.),comma8.2);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 May 2016 17:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269520#M53420</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-05-10T17:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269522#M53421</link>
      <description>&lt;P&gt;But if you store it as character your numbers won't sort properly in tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something to keep in mind. There may be some workarounds but it's easier to keep it as a number, IMO.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 17:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269522#M53421</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-10T17:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269523#M53422</link>
      <description>&lt;P&gt;But if you store it as character your numbers won't sort properly in tables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something to keep in mind. There may be some workarounds but it's easier to keep it as a number, IMO.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2016 17:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269523#M53422</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-10T17:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: hOW TO PUT COMMA TO THE NUMBERS IN THE OUTPUT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269717#M53470</link>
      <description>&lt;P&gt;Thank you for your code.&lt;/P&gt;&lt;P&gt;I guess there should be another way of changing the template. I recall I was using another code and it worked very well but I got a warning/note saying that I was changing the template. Then due to my comptuer problem, maybe because of installtion of something, setting changed, it changes back.&lt;/P&gt;&lt;P&gt;I&amp;nbsp;am thinking I am looking for a code to change a template, that means, I expect all my table output has the format, that is 567,900, instead of 567900&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any code of changing the template, instead of a single variables. That will be too much work&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2016 13:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-comma-in-the-numbers-of-the-output/m-p/269717#M53470</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-05-11T13:23:00Z</dc:date>
    </item>
  </channel>
</rss>

