<?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: Datalines Truncating Last Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490151#M128157</link>
    <description>&lt;P&gt;If you specify a format without the colon modifier, the length of the format overrides the delimiters. So the second 3.1 format starts to read immediately after the first, and reads a blank, a digit, and the period.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Aug 2018 16:17:31 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-27T16:17:31Z</dc:date>
    <item>
      <title>Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490128#M128143</link>
      <description>&lt;P&gt;Hi guys, I want to create a dataset with the datalines statement that includes Canadian bankruptcy data by NAICS (straight from&amp;nbsp;&lt;A href="https://www.ic.gc.ca/eic/site/bsf-osb.nsf/eng/br02234.html).&amp;nbsp;" target="_blank"&gt;https://www.ic.gc.ca/eic/site/bsf-osb.nsf/eng/br02234.html).&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My datastep looks a little like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;data industry_BK;&lt;BR /&gt;length Industry $15 NAICS $2;&lt;BR /&gt;input Industry $ NAICS $ BK_rate 3.1 Ins_Rate 3.1;&lt;BR /&gt;datalines;&lt;BR /&gt;Agriculture 11 0.2 0.3&lt;BR /&gt;Mining 21 1.3 2.1&lt;BR /&gt;Utilities 22 1.2 1.2&lt;BR /&gt;Construction 23 1.3 1.8&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/PRE&gt;&lt;P&gt;However, when I run this, I get the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS_Table.png" style="width: 396px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/22805i20E69D51BD3913BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS_Table.png" alt="SAS_Table.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It appears to grab the first digit, but loses everything after the decimal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've read through a few documentation pages, but clearly I'm just not getting it. Can someone help me to understand why this doesn't work and how I can fix it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:36:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490128#M128143</guid>
      <dc:creator>MickyTee</dc:creator>
      <dc:date>2018-08-27T15:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490138#M128148</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try this, I used the format best12. for the numeric variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data industry_BK;
length Industry $15 NAICS $2;
format BK_rate best12. Ins_Rate best12.;
input Industry $ NAICS $ BK_rate Ins_Rate;
datalines;
Agriculture 11 0.2 0.3
Mining 21 1.3 2.1
Utilities 22 1.2 1.2
Construction 23 1.3 1.8
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 15:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490138#M128148</guid>
      <dc:creator>sv_sas</dc:creator>
      <dc:date>2018-08-27T15:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490144#M128153</link>
      <description>&lt;P&gt;Try this. It should work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data industry_BK;
length Industry $15 NAICS $2;
input Industry $ NAICS $ BK_rate Ins_Rate 3.1;
datalines;
Agriculture 11 0.2 0.3 
Mining 21 1.3 2.1 
Utilities 22 1.2 1.2 
Construction 23 1.3 1.8 
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490144#M128153</guid>
      <dc:creator>AlokR</dc:creator>
      <dc:date>2018-08-27T16:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490146#M128155</link>
      <description>&lt;P&gt;Both of those approaches did the trick, thanks very much both of you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas why specifying "3.1" after the input statement on BK_rate seems to ruin things?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:09:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490146#M128155</guid>
      <dc:creator>MickyTee</dc:creator>
      <dc:date>2018-08-27T16:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490151#M128157</link>
      <description>&lt;P&gt;If you specify a format without the colon modifier, the length of the format overrides the delimiters. So the second 3.1 format starts to read immediately after the first, and reads a blank, a digit, and the period.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:17:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490151#M128157</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-27T16:17:31Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490159#M128162</link>
      <description>&lt;P&gt;DO NOT use formatted input with delimited data.&amp;nbsp; You do not need to specify ANY informats in your INPUT statement for that data as SAS already knows how to read numbers, but if you do add informat specificatons then you must proceed them with the colon modifier.&amp;nbsp; That will prevent SAS from reading EXACTLY that many characters and messing up how the delimiter processing works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also DO NOT add a decimal part to an informat unless you know that the decimal points were purposely removed from the raw text values.&amp;nbsp; Otherwise any values that do not contain a period will be divided by the specified power of ten.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490159#M128162</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-27T16:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490161#M128164</link>
      <description>&lt;P&gt;Thanks Kurt and Tom for the detailed answers!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2018 16:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490161#M128164</guid>
      <dc:creator>MickyTee</dc:creator>
      <dc:date>2018-08-27T16:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Datalines Truncating Last Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490219#M128189</link>
      <description>Another feature might be worth learning for reading fixed layouts. &lt;BR /&gt;Should the last field on a line be short the INPUT parser would find not enough to fill the informat. and skip onto the next line to fill the field from there. Usually that is not what is wanted.&lt;BR /&gt;   INFILE whatever TRUNCOVER;&lt;BR /&gt;The TRUNCOVER option directs the INPUT parser to accept a shortened last field.&lt;BR /&gt;Alternatives are available&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 27 Aug 2018 18:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datalines-Truncating-Last-Variable/m-p/490219#M128189</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2018-08-27T18:56:08Z</dc:date>
    </item>
  </channel>
</rss>

