<?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: Separating numbers in an input file by commas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/660103#M197625</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;The numbers are seperated by columns; e.g. 1,356,292 (meaning approximately 4/3). But when I import the file via proc import:&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Excel is storing that as one million three hundred fifty six thousand two hundred ninety two, not 4/3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that value is actually comma separated numbers then you'll need to format that column &lt;STRONG&gt;as text&lt;/STRONG&gt; within Excel.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately when reading from Excel it's very difficult to force the types when importing data, if you're reading from a different source such as CSV, XML or JSON.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jun 2020 16:34:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-06-16T16:34:08Z</dc:date>
    <item>
      <title>Separating numbers in an input file by commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659705#M197580</link>
      <description>&lt;P&gt;Hello SAS Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an excel data file, where the columns are full of numbers. The numbers are seperated by columns; e.g. 1,356,292 (meaning approximately 4/3). But when I import the file via proc import:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = data
  out=data
  dbms=xlsx
  replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;SAS reads this as 1356292.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy step to convert it "back" to the original format? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 08:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659705#M197580</guid>
      <dc:creator>YangM90</dc:creator>
      <dc:date>2020-06-16T08:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Separating numbers in an input file by commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659777#M197581</link>
      <description>&lt;P&gt;That number can never be equivalent to ~1.3. It was, is, and will always be&amp;nbsp;&lt;SPAN&gt;1356292. You cannot have more than one decimal point (either represented by the period or the comma, depending on locale) in a number.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Otherwise, how could you know it's not 1356.292?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 09:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659777#M197581</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-16T09:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Separating numbers in an input file by commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659778#M197582</link>
      <description>&lt;P&gt;The problem is, that "1,356,292" is only a valid number if the comma is treated as thousands-separator, which is exactly what SAS does. If the data would be stored in a proper file-format for holding data (like csv), you could write code to fix the strange format, but with excel post-processing the data is the only option you have. And for that rules must exists defining the meaning of the comma at its various positions.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 09:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659778#M197582</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-06-16T09:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Separating numbers in an input file by commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659984#M197592</link>
      <description>&lt;P&gt;Even with Excel there is a difference between how a number "prints" formatted and what's stored internally.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1592302769231.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/43923iCFC7EEC607EE7EB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1592302769231.png" alt="Patrick_0-1592302769231.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS reads the internal value and then applies a standard SAS format for printing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can always change the format also in SAS.&lt;/P&gt;
&lt;P&gt;On-the-fly within a single Procedure&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  myvar=1356292;
  output;
  stop;
run;

proc print data=test;
  format myvar comma16.;
  var myvar;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1592303014079.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/43924i81213C3528B312D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1592303014079.png" alt="Patrick_0-1592303014079.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Or permanently attached to the variable in the table:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
  modify test;
    format myvar comma16.;
  run;
quit;

proc print data=test;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1592303028175.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/43925iC5F8E11DCB8D687B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1592303028175.png" alt="Patrick_1-1592303028175.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 10:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/659984#M197592</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-16T10:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Separating numbers in an input file by commas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/660103#M197625</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;The numbers are seperated by columns; e.g. 1,356,292 (meaning approximately 4/3). But when I import the file via proc import:&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Excel is storing that as one million three hundred fifty six thousand two hundred ninety two, not 4/3.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that value is actually comma separated numbers then you'll need to format that column &lt;STRONG&gt;as text&lt;/STRONG&gt; within Excel.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately when reading from Excel it's very difficult to force the types when importing data, if you're reading from a different source such as CSV, XML or JSON.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jun 2020 16:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Separating-numbers-in-an-input-file-by-commas/m-p/660103#M197625</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-06-16T16:34:08Z</dc:date>
    </item>
  </channel>
</rss>

