<?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: How do i read these data correctly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/479410#M123742</link>
    <description>&lt;P&gt;That solve the mystery!! &lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://communities.sas.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jul 2018 07:59:56 GMT</pubDate>
    <dc:creator>Dennis_K</dc:creator>
    <dc:date>2018-07-19T07:59:56Z</dc:date>
    <item>
      <title>How do i read these data correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478956#M123570</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I can't get SAS to read the following data correctly using list input. Any Ideas???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data LFC1819;&lt;BR /&gt;input Pos :$2.&lt;BR /&gt;Pname &amp;amp;$30.&lt;BR /&gt;Fee :comma10.;&lt;BR /&gt;datalines;&lt;BR /&gt;DM Fabinho 30,000,000&lt;BR /&gt;GK Alisson Becker 76,000,000&lt;BR /&gt;DM Naby Keita 55,000,000&lt;BR /&gt;FW Xherdan Shaqiri 12,000,000&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 08:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478956#M123570</guid>
      <dc:creator>Dennis_K</dc:creator>
      <dc:date>2018-07-18T08:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do i read these data correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478967#M123574</link>
      <description>&lt;P&gt;I would use a specific delimiter between the data values to avoid any confusion, see code below.&lt;/P&gt;
&lt;P&gt;when using the "&amp;amp;" modifier you need two consecutive blanks to delimit the data values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data LFC1819;
  infile cards dlm=";";
  input
    Pos :$2.
    Pname : $30.
    Fee : comma10.
  ;
datalines4;
DM;Fabinho;30,000,000
GK;Alisson Becker;76,000,000
DM;Naby Keita;55,000,000
FW;Xherdan Shaqiri;12,000,000
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 09:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478967#M123574</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2018-07-18T09:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do i read these data correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478969#M123576</link>
      <description>&lt;P&gt;My preferred action:&lt;/P&gt;
&lt;P&gt;go to the source of the data and ask for a better designed layout, with delimiters that do not appear in data fields, or with quotes around data fields, so that the dsd option can be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Right now, you would have to read the whole input line (_infile_), and extract the first and last "word" for pos and fee (use findc() to find the first and last delimiter), and put the remaining part into pname. You can imagine how "brittle" such a process is, and how much work you'd have maintaining that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simple delimiter change, and all your problems are gone:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data LFC1819;
infile datalines dlm=';';
input
  Pos :$2.
  Pname :$30.
  Fee :comma10.
;
datalines4;
DM;Fabinho;30,000,000
GK;Alisson Becker;76,000,000
DM;Naby Keita;55,000,000
FW;Xherdan Shaqiri;12,000,000
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 09:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478969#M123576</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-18T09:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do i read these data correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478971#M123578</link>
      <description>&lt;P&gt;As suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32"&gt;@BrunoMueller&lt;/a&gt;, it would be easier if you rewrote your infile. But assuming that you get it from someone else, that is not always possible. In which case you will have to read the data to temporary fields and then parse, e.g.:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data LFC1819;
length pos $2 Pname $30 str2 str3 $20;
infile cards truncover;
input pos--str3;
if lengthn(str3) then do;
  call catx(' ',pname,str2);
  Fee=input(str3,comma10.);
  end;
else
  Fee=input(str2,comma10.);
drop str2 str3;
datalines;
DM Fabinho 30,000,000
GK Alisson Becker 76,000,000
DM Naby Keita 55,000,000
FW Xherdan Shaqiri 12,000,000
;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 09:59:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478971#M123578</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-07-18T09:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do i read these data correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478977#M123581</link>
      <description>&lt;P&gt;Actually, it's only the the missing double blank between Pname and Fee that lets your INPUT statement fail. So, another approach would be to let SAS insert the missing blank:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data LFC1819;
input @;
_infile_=prxchange('s/( [\d,\.]+)/ $1/',1,_infile_);
input Pos :$2.
Pname &amp;amp;$30.
Fee :comma10.;
datalines;
DM Fabinho 30,000,000
GK Alisson Becker 76,000,000
DM Naby Keita 55,000,000
FW Xherdan Shaqiri 12,000,000
FW Cristiano Ronaldo (aka CR7) 112,000,000
?? John Doe .
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I've added two more data lines to demonstrate that digits contained in names (not preceded by a blank, though) and missing values of Fee are handled correctly.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 10:31:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/478977#M123581</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-07-18T10:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do i read these data correctly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/479410#M123742</link>
      <description>&lt;P&gt;That solve the mystery!! &lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://communities.sas.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2018 07:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-read-these-data-correctly/m-p/479410#M123742</guid>
      <dc:creator>Dennis_K</dc:creator>
      <dc:date>2018-07-19T07:59:56Z</dc:date>
    </item>
  </channel>
</rss>

