<?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: Read values with comma in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571633#M161260</link>
    <description>&lt;P&gt;In the output data set I see values:&lt;/P&gt;
&lt;P&gt;382&lt;BR /&gt;235&lt;BR /&gt;391&lt;/P&gt;
&lt;P&gt;instead of :&lt;/P&gt;
&lt;P&gt;1382&lt;/P&gt;
&lt;P&gt;1235&lt;/P&gt;
&lt;P&gt;2391&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 07 Jul 2019 06:45:52 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-07-07T06:45:52Z</dc:date>
    <item>
      <title>Read values with comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571629#M161258</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;The data set that is created is not correct.&lt;/P&gt;
&lt;P&gt;As can see the values of the amount field are not correct.&lt;/P&gt;
&lt;P&gt;Why did it happen? How can solve it ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
infile datalines truncover dsd;
input item : $6. amount comma5.;
datalines;
trucks 1,382
vans   1,235
sedans 2,391
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Jul 2019 06:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571629#M161258</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-07-07T06:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Read values with comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571631#M161259</link>
      <description>&lt;P&gt;Which values did you expect? COMMAw. will read 1,382 as 1382.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2019 06:35:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571631#M161259</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-07T06:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Read values with comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571633#M161260</link>
      <description>&lt;P&gt;In the output data set I see values:&lt;/P&gt;
&lt;P&gt;382&lt;BR /&gt;235&lt;BR /&gt;391&lt;/P&gt;
&lt;P&gt;instead of :&lt;/P&gt;
&lt;P&gt;1382&lt;/P&gt;
&lt;P&gt;1235&lt;/P&gt;
&lt;P&gt;2391&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2019 06:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571633#M161260</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-07-07T06:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Read values with comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571648#M161273</link>
      <description>&lt;P&gt;What you do depends on the exact format of your input.&lt;/P&gt;
&lt;P&gt;If you have fixed columns (as your initial post suggests), you should use those:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input @1 item :$6. @8 amount :comma5.;
datalines;
trucks 1,382
vans   1,235
sedans 2,391
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If in fact, you have the blank as a delimiter, it should look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
infile datalines truncover dlm=' ' dsd;
input item : $6. amount :comma5.;
datalines;
trucks 1,382
vans 1,235
sedans 2,391
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that there is only a single blank in each input line.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jul 2019 11:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571648#M161273</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-07T11:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Read values with comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571661#M161281</link>
      <description>&lt;P&gt;Your data lines are not properly formatted for use with the DSD option.&amp;nbsp; If you are using the DSD option and a value contains the delimiter then that value should be in quotes.&amp;nbsp; Since you didn't specify a delimiter the use of DSD also changes from space to comma as the delimiter.&amp;nbsp; So remove the DSD option.&lt;/P&gt;
&lt;P&gt;You should also include the : modifier so that it reads the data using list mode instead of formatted mode.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
  infile datalines truncover;
  input item : $6. amount :comma.;
datalines;
trucks 1,382
vans   1,235
sedans 2,391
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note there is no need for a width on the in-line informat when using list mode as the INPUT statement will ignore your width and instead use the width of the actual next word to be read.&amp;nbsp; The width on the informat for ITEM will force SAS to guess that you meant to create ITEM as a character variable (because of the use of a character informat) and that you wanted it to use 6 bytes instead of the default 8 bytes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also there is no need for the RUN statement after the end of your data step.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 04:06:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-values-with-comma/m-p/571661#M161281</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-08T04:06:51Z</dc:date>
    </item>
  </channel>
</rss>

