<?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: format combining BEST and COMMA? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572409#M75334</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; A period for three digits and a comma for the decimals is indeed the French format obtained with COMMAXw.d, my mistake in the description sorry. What I was looking for is a nice looking format (such as COMMA or COMMAX) with no decimals displayed when integers (like BEST)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;Thank you for confirming that there is no format doing this&amp;nbsp;ready for use. I will look how to build it with PROC FCMP. Thank you for the example of this in your link &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 15:29:33 GMT</pubDate>
    <dc:creator>Alain38</dc:creator>
    <dc:date>2019-07-10T15:29:33Z</dc:date>
    <item>
      <title>format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572380#M75330</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not a very important question but I was wondering if there were a format or workaround to display values without decimals when they are integers (like BESTw.), &lt;U&gt;and&lt;/U&gt; with a period that separates every three digits and a comma that separates the decimal fraction (like COMMAw.d)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 14:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572380#M75330</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-10T14:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572387#M75331</link>
      <description>&lt;P&gt;Not that I know of.&amp;nbsp; You might be able to create one using PROC FCMP so that you can test if the value is an integer and use a different format in those cases.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 14:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572387#M75331</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-10T14:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572396#M75332</link>
      <description>Sounds like the french format? I'm actually pretty sure SAS has a format for that.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Format-numeric-variable-to-seperate-thousands-with-a-space/td-p/98352" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Format-numeric-variable-to-seperate-thousands-with-a-space/td-p/98352&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Numeric-format-with-decimal-comma/td-p/334697" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Numeric-format-with-decimal-comma/td-p/334697&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And commaXw.d format is what you want:&lt;BR /&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n056hzkipsxpcbn11ww9i9i47l0h.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n056hzkipsxpcbn11ww9i9i47l0h.htm&lt;/A&gt;</description>
      <pubDate>Wed, 10 Jul 2019 15:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572396#M75332</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-10T15:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572409#M75334</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; A period for three digits and a comma for the decimals is indeed the French format obtained with COMMAXw.d, my mistake in the description sorry. What I was looking for is a nice looking format (such as COMMA or COMMAX) with no decimals displayed when integers (like BEST)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;Thank you for confirming that there is no format doing this&amp;nbsp;ready for use. I will look how to build it with PROC FCMP. Thank you for the example of this in your link &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 15:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572409#M75334</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-10T15:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572411#M75335</link>
      <description>You can try using a nested format along with PROC FCMP then. Do you want the variable as a character or numeric? If character this is quite easy within a single line, otherwise it's slightly more work.</description>
      <pubDate>Wed, 10 Jul 2019 15:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572411#M75335</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-10T15:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572412#M75336</link>
      <description>&lt;P&gt;Need it numeric... but this is just to improve the display so not vital. I will look into that but if this is really too complicated, I will not do it. Thank you for your answers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 15:39:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572412#M75336</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-10T15:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572460#M75337</link>
      <description>&lt;P&gt;If the range of values is not too large you could just list all of the integers in the range.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data formats ;
  retain fmtname 'mycomma' type 'n' hlo 'f  ' label 'commax8. ';
  do start=-999 to 9999 ;
    output;
  end;
  start=.;
  hlo='fo';
  label='commax8.2';
  output;
  stop;
run;
proc format cntlin=formats;
run;

data test;
  do x=1 to 3,12.5,1234,-300,3456.1;
   output;
  end;
run;
proc print data=test;
 format x mycomma.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs       x

 1            1
 2            2
 3            3
 4        12,50
 5        1.234
 6         -300
 7     3.456,10
&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:06:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572460#M75337</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-10T18:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572462#M75338</link>
      <description>&lt;P&gt;Thank you very much &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; for your help. Unfortunately the range of values is absolutely huge (that's the market value of each U.S. firm, so there are small companies and some huge firms like Facebook...)&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572462#M75338</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-10T18:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572614#M75342</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/85578"&gt;@Alain38&lt;/a&gt;,&amp;nbsp;I think this gives you what you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.functions.fun; 
  function fnc(num) $;
    if num=int(num) then r=scan(strip(put(num, commax32.10)), 1, ',');
    else                 r=tranwrd(strip(tranwrd(strip(put(num, commax32.10)), "0", " "))," ","0");
    return (r);
  endsub;
run;

options cmplib=work.functions;    
proc format;
  value fmt (default=32) other=[fnc()];
run;

data test;
   x=1234.567;output; 
   x=-1234.00;output; 
   x=1234567 ;output;
   x=1.23    ;output;   

   format x fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2019 06:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572614#M75342</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-11T06:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572625#M75343</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp; Thank you very much it's working perfectly! Just to be sure to understand the code, I adapted it to the English format if someone needs (personnaly I need both):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.functions.fun; 
	function fnc(num) $;
		if num=int(num) then r=scan(strip(put(num, comma32.10)), 1, '.');
		else r=tranwrd(strip(tranwrd(strip(put(num, comma32.10)), "0", " "))," ","0");
		return (r);
	endsub;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2019 07:52:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572625#M75343</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-11T07:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: format combining BEST and COMMA?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572629#M75344</link>
      <description>&lt;P&gt;Glad to help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Can't test it right not, but it looks right to me.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 08:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/format-combining-BEST-and-COMMA/m-p/572629#M75344</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-11T08:07:56Z</dc:date>
    </item>
  </channel>
</rss>

