<?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: Skipping lines with DATALINES; in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172055#M44366</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pop a length statement in first, then remove the 10 from the input.&amp;nbsp; Also, would recommend that approach, i.e. what happens with missing?&amp;nbsp; A suggestion would be to go with CSV.&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length name1 $20 num1 8 name2 $20;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Name1 $ Num1 Name2 $;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;testing&lt;/P&gt;&lt;P&gt;444&lt;/P&gt;&lt;P&gt;dd&lt;/P&gt;&lt;P&gt;small&lt;/P&gt;&lt;P&gt;33321&lt;/P&gt;&lt;P&gt;asdfasdfas&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Feb 2015 14:46:59 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-02-17T14:46:59Z</dc:date>
    <item>
      <title>Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172054#M44365</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;I have the following DATA step which should read in 2 observations with 3 variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Name1 $ Num1 Name2 $10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;testing&lt;/P&gt;&lt;P&gt;444&lt;/P&gt;&lt;P&gt;dd&lt;/P&gt;&lt;P&gt;small&lt;/P&gt;&lt;P&gt;33321&lt;/P&gt;&lt;P&gt;asdfasdfas&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The $10. informat is necessary to read in all of "asdfasdfas".&amp;nbsp; This gives the following output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obs&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Name1&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Num1&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Name2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;testing&amp;nbsp;&amp;nbsp; 444&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;dd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;33321&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If I use $ instead of $10. the data will be correct except it cuts off asdfasdfas at the 8 characters, as is the default.&amp;nbsp; I know that SAS reads datalines with padded zeros, but why does the informat cause "dd" to not be read correctly?&amp;nbsp; This issue does not happen if I store the datalines in the txt file and read that data in with an INFILE statement.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 14:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172054#M44365</guid>
      <dc:creator>JonS</dc:creator>
      <dc:date>2015-02-17T14:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172055#M44366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pop a length statement in first, then remove the 10 from the input.&amp;nbsp; Also, would recommend that approach, i.e. what happens with missing?&amp;nbsp; A suggestion would be to go with CSV.&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length name1 $20 num1 8 name2 $20;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Name1 $ Num1 Name2 $;&lt;/P&gt;&lt;P&gt;&amp;nbsp; datalines;&lt;/P&gt;&lt;P&gt;testing&lt;/P&gt;&lt;P&gt;444&lt;/P&gt;&lt;P&gt;dd&lt;/P&gt;&lt;P&gt;small&lt;/P&gt;&lt;P&gt;33321&lt;/P&gt;&lt;P&gt;asdfasdfas&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 14:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172055#M44366</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-17T14:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172056#M44367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's interesting that the LENGTH statement fixes this.&amp;nbsp; My question is more about why doesn't it work than how to fix it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is SAS doing that makes my code not work correctly?&amp;nbsp; Why does the LENGTH statement fix it?&amp;nbsp; Does it have something to do with how the INFORMAT controls the column pointer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 14:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172056#M44367</guid>
      <dc:creator>JonS</dc:creator>
      <dc:date>2015-02-17T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172057#M44368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;$10. changes the INPUT "type" from LIST to FORMATTED and that is the problem.&amp;nbsp; You need to use &lt;STRONG&gt; :&lt;/STRONG&gt; modifier to allow use of and INFORMAT and stay in LIST input mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input Name1 $ Num1 Name2&lt;STRONG style="font-size: 18pt;"&gt; :&lt;/STRONG&gt; $10.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 14:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172057#M44368</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-02-17T14:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172058#M44369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The LENGTH statement is not what fixed it. It was the removal of the hardcoded $10. informat.&lt;/P&gt;&lt;P&gt;The LENGTH statement just lets you EXPLICITLY set the length/type for your variables rather than forcing SAS to guess what you want from your other statements.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 15:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172058#M44369</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-02-17T15:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172059#M44370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data _null_; and Tom have answered the question, however its another reason to be quite clear in the code and not let SAS do guess work behind the scenes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 15:14:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172059#M44370</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-02-17T15:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172060#M44371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I understand now.&amp;nbsp; Specifying informats in the INPUT statement allows you to specify an informat along with a column input style.&amp;nbsp; The first two variables use list input style so they stop being read once it hits the end of the line.&amp;nbsp; Since the last variable had a hardcoded informat, it didn't skip to the next line and instead read the hidden padded zeroes after the 444.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 15:19:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172060#M44371</guid>
      <dc:creator>JonS</dc:creator>
      <dc:date>2015-02-17T15:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Skipping lines with DATALINES;</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172061#M44372</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;Continuing a little bit &lt;STRONG&gt;data _null_ &lt;/STRONG&gt;explanation , when you have switched to FORMATTED INPUT , SAS reads from where the pointer is therefore it does not scan for the next value as the case when reading data with LIST INPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may find these links useful:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003209907.htm"&gt;http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a003209907.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000144370.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 15:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Skipping-lines-with-DATALINES/m-p/172061#M44372</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-02-17T15:22:02Z</dc:date>
    </item>
  </channel>
</rss>

