<?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: Comma after a number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696887#M212949</link>
    <description>And in excel I do not need the column heading.</description>
    <pubDate>Thu, 05 Nov 2020 14:36:34 GMT</pubDate>
    <dc:creator>Caro17</dc:creator>
    <dc:date>2020-11-05T14:36:34Z</dc:date>
    <item>
      <title>Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696811#M212904</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to add a comma after a lot of numbers.&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;before&lt;/P&gt;&lt;P&gt;1234567&lt;/P&gt;&lt;P&gt;89012345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after&lt;/P&gt;&lt;P&gt;1234567,&lt;/P&gt;&lt;P&gt;89012345,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried it with catx, but it does not function. Then I tried it with cats and on first sight it seems to function. But a closer look showed me that the comma ends as soon as the figure changes from seven-digit to eight-digit. From this point on there are no commas after the numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And at the end I want to have the new column in an excel file. But the systems told me that the file cannot be opened or repaired as it is damaged.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want&lt;/P&gt;&lt;P&gt;set order&lt;/P&gt;&lt;P&gt;order_no_str = put(lngorder_no, 8.);&lt;/P&gt;&lt;P&gt;format order_no_str$100.;&lt;/P&gt;&lt;P&gt;order_no_str=cats(order_no_str,’, ');&lt;/P&gt;&lt;P&gt;If length(order_no_str)&amp;gt;90 then do;&lt;/P&gt;&lt;P&gt;put 'ERROR: …';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;ods excel file '\\abc\agency\…\order2020.xlsx’;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I solve these problems?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanx a lot!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Caro&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 09:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696811#M212904</guid>
      <dc:creator>Caro17</dc:creator>
      <dc:date>2020-11-05T09:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696812#M212905</link>
      <description>&lt;P&gt;I am by no means an expert ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you need your Variables(numbers) to be number or Character values ?&lt;/P&gt;&lt;P&gt;What would the use of the comma be for ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hanno&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 10:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696812#M212905</guid>
      <dc:creator>Hanno</dc:creator>
      <dc:date>2020-11-05T10:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696815#M212907</link>
      <description>&lt;P&gt;With this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;order_no_str = put(lngorder_no, 8.);
format order_no_str$100.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;you first define the length as 8. The later FORMAT statement will not change the length.&lt;/P&gt;
&lt;P&gt;Do this instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length order_no_str$100.;
order_no_str = put(lngorder_no, 8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is never a good idea to try to set the length implicitly through a FORMAT. Instead do it explicitly with LENGTH. If the LENGTH can't work for some reason, you'll get a note in the log; with FORMAT, you don't get that.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 10:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696815#M212907</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-05T10:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696827#M212914</link>
      <description>&lt;P&gt;I you simply want to display a comma after a number, you can roll out a picture format like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
   picture c other = '00000009,';
run;

data have;
   x = 1234567; output;
   x = 89012345; output;
   format x c.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Nov 2020 10:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696827#M212914</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-05T10:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696842#M212923</link>
      <description>&lt;P&gt;Thank you for the quick help. But what about the other problem with the excel file?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 12:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696842#M212923</guid>
      <dc:creator>Caro17</dc:creator>
      <dc:date>2020-11-05T12:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696847#M212925</link>
      <description>&lt;P&gt;ODS is the&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;O&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;utput&lt;/EM&gt;&amp;nbsp;&lt;STRONG&gt;D&lt;/STRONG&gt;elivery &lt;STRONG&gt;S&lt;/STRONG&gt;ystem. To have stuff in your Excel file, you need to create &lt;EM&gt;output&lt;/EM&gt;, but your data step will "only" create a dataset.&lt;/P&gt;
&lt;P&gt;And you need to close the ODS destination, or your Excel file will still be open for output.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set order;
length order_no_str $100;
order_no_str = cats(put(lngorder_no, 8.),',');
run;

ods excel file='\\abc\agency\…\order2020.xlsx’;

proc print data=want;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you still have problems, post the complete log from your steps and ODS statements, using the &amp;lt;/&amp;gt; button (&lt;STRONG&gt;required!&lt;/STRONG&gt;).&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 12:52:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696847#M212925</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-05T12:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696885#M212947</link>
      <description>&lt;P&gt;Do I really need proc print? It is not necessary to see it in SAS again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I get an excel file, but without the comma after the number.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 14:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696885#M212947</guid>
      <dc:creator>Caro17</dc:creator>
      <dc:date>2020-11-05T14:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comma after a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696887#M212949</link>
      <description>And in excel I do not need the column heading.</description>
      <pubDate>Thu, 05 Nov 2020 14:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comma-after-a-number/m-p/696887#M212949</guid>
      <dc:creator>Caro17</dc:creator>
      <dc:date>2020-11-05T14:36:34Z</dc:date>
    </item>
  </channel>
</rss>

