<?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: Understanding the infile + input combination in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121824#M24959</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That makes a lot of sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jan 2013 21:28:36 GMT</pubDate>
    <dc:creator>ArtemisFowl</dc:creator>
    <dc:date>2013-01-11T21:28:36Z</dc:date>
    <item>
      <title>Understanding the infile + input combination</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121822#M24957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When reading a .txt file into SAS, I have trouble figuring out exactly why something works and something else doesn't.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, I have a text file with this content:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE bgcolor="#CCCCCC" border="1" cellpadding="0" cellspacing="0" class="rawdata" frame="BOX" rules="NONE" title="Raw Data File"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#F7F7DE" height="20"&gt;&lt;SPAN style="color: #000000; font-family: Courier New,Courier; font-size: 10pt;"&gt;1---+---&lt;STRONG&gt;-&lt;/STRONG&gt;10---+----20---+---&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#FFFFFF"&gt;&lt;SPAN style="color: #000000; font-family: Courier New,Courier; font-size: 10pt;"&gt;01/05/1989&amp;nbsp;&amp;nbsp;&amp;nbsp; Rick&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11 &lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD bgcolor="#FFFFFF"&gt;&lt;SPAN style="color: #000000; font-family: Courier New,Courier; font-size: 10pt;"&gt;12/25/1987&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Courier New,Courier; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sue&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13 &lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD bgcolor="#FFFFFF"&gt;&lt;SPAN style="color: #000000; font-family: Courier New,Courier; font-size: 10pt;"&gt;01/05/1991&amp;nbsp;&amp;nbsp;&amp;nbsp; Sally&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9 &lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I run the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;data work.family;&lt;/P&gt;&lt;P style="text-align: left;"&gt;&amp;nbsp;&amp;nbsp; infile 'C:\test.txt';&lt;/P&gt;&lt;P style="text-align: left;"&gt;&amp;nbsp;&amp;nbsp; input @1 birth_date mmddyy10.&lt;/P&gt;&lt;P style="text-align: left;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @15 first_name $5.&lt;/P&gt;&lt;P style="text-align: left;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @25 age 3.;&lt;/P&gt;&lt;P style="text-align: left;"&gt;run;&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;then I get a dataset with only one row, namely&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;10597 Rick .&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;So the date and name turns out alright, but the age doesn't.&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;If I include the "truncover" option, then the output turns out alright, but I have no idea why.&lt;/P&gt;&lt;P style="text-align: left;"&gt;&lt;/P&gt;&lt;P style="text-align: left;"&gt;Kind regards,&lt;/P&gt;&lt;P style="text-align: left;"&gt;Rasmus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 21:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121822#M24957</guid>
      <dc:creator>ArtemisFowl</dc:creator>
      <dc:date>2013-01-10T21:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the infile + input combination</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121823#M24958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You told it to try to read past the end of the line.&amp;nbsp; The first row has only 26 characters and your input statement tried to read 27 so it flowed over to the next line to get more characters. So the first pass through the data step "eats" the first two lines and results in the observation you see.&amp;nbsp; On the second pass you again tried to read past the end of the line so it tried to get more again, but this time there were no more lines so the data step stopped without writing the observation for Sally because you read past the end of the input file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRUNCOVER is the best way to fix this.&lt;/P&gt;&lt;P&gt;You can also add : prefix to your informats.&amp;nbsp; This will tell SAS to stop looking for characters when it hits a space or an end of line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data work.family;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; infile 'C:\test.txt';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; input @1 birth_date : mmddyy10.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @15 first_name : $5.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @25 age : 3.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 21:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121823#M24958</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-01-10T21:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding the infile + input combination</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121824#M24959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Tom.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That makes a lot of sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jan 2013 21:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-the-infile-input-combination/m-p/121824#M24959</guid>
      <dc:creator>ArtemisFowl</dc:creator>
      <dc:date>2013-01-11T21:28:36Z</dc:date>
    </item>
  </channel>
</rss>

