<?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 converting decimal period seperators to comma seperators in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710772#M218855</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;I have a question I have a dataset exported from postgresql and there are columns containing whole numbers as well as decimal numbers. The decimals numbers are seperated with periods (e.g. 0.166)&lt;/P&gt;
&lt;P&gt;and the whole numbers are like 50, 75, 100 etc. These values are imported into SAS with format best12. I wish to change the period to comma like 0.166 should be 0,166&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option locale = de_DE;
data xyz;
data want;
format ab commax7.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That works well, my question is, is it possible to make SAS only set the decimal numbers to 2 decimal places? The whole numbers like 50, 75 should not be written as 50,00 or 75,00&lt;/P&gt;
&lt;P&gt;I guess this is not possible but there might be a way to work around this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The column should remain like in the original data only the period should be replaced with a comma&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2021 10:41:34 GMT</pubDate>
    <dc:creator>Anita_n</dc:creator>
    <dc:date>2021-01-12T10:41:34Z</dc:date>
    <item>
      <title>converting decimal period seperators to comma seperators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710772#M218855</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;I have a question I have a dataset exported from postgresql and there are columns containing whole numbers as well as decimal numbers. The decimals numbers are seperated with periods (e.g. 0.166)&lt;/P&gt;
&lt;P&gt;and the whole numbers are like 50, 75, 100 etc. These values are imported into SAS with format best12. I wish to change the period to comma like 0.166 should be 0,166&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;option locale = de_DE;
data xyz;
data want;
format ab commax7.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That works well, my question is, is it possible to make SAS only set the decimal numbers to 2 decimal places? The whole numbers like 50, 75 should not be written as 50,00 or 75,00&lt;/P&gt;
&lt;P&gt;I guess this is not possible but there might be a way to work around this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The column should remain like in the original data only the period should be replaced with a comma&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 10:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710772#M218855</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-01-12T10:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: converting decimal period seperators to comma seperators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710793#M218873</link>
      <description>&lt;P&gt;If you want to use PROC REPORT to create an output table with these formats, yes it is possible.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you can also use PROC FCMP to create a function used as a format, see&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p1gg77jyhc9s42n1f1vjyx2hsg8b.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p1gg77jyhc9s42n1f1vjyx2hsg8b.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 12:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710793#M218873</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-12T12:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: converting decimal period seperators to comma seperators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710796#M218876</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp outlib=work.func.math;
function x(x) $;
 length result $ 40;
 if mod(x,1)=0 then result=left(put(x,best32.));
  else result=left(put(x,commax32.2 ));
  return (result);
endsub;
run;

options cmplib=work.func;
proc format ;
picture fmt
low-high=[x()];
run;

data x;
input x;
format x fmt10.;
cards;
73.21
65
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am not sure I understood what you are looking for.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 12:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-decimal-period-seperators-to-comma-seperators/m-p/710796#M218876</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-12T12:33:05Z</dc:date>
    </item>
  </channel>
</rss>

