<?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: SAS truncating last character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925874#M364332</link>
    <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, how do I tell SAS to read more than 8 chararcters?</description>
    <pubDate>Thu, 25 Apr 2024 19:55:06 GMT</pubDate>
    <dc:creator>PamG</dc:creator>
    <dc:date>2024-04-25T19:55:06Z</dc:date>
    <item>
      <title>DATALINES: SAS truncating last character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925871#M364329</link>
      <description>&lt;P&gt;This seems like a very simple thing but I just can't seem to get it write.&amp;nbsp; When using the code below, SAS is truncating the last character wherever variable length is greater than 9.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA bins;
INPUT binnum bin_desc $ @@;
FORMAT bin_desc $10.;
DATALINES;
1 [-20,-15) 2 [-5,0) 3 [0,5) 4 [5,10) 5 [10,15) 6 [15,20) 7 [20,25) 8 [25,30) 8 [30,35) 10 [35,40) 
11 [40,45) 12 [45,50) 13 [55,60) 14 [60,65) 15 [65,70) 16 [70,75) 17 [75,80) 18 [80,85) 19 [85,90) 
20 [90,95) 21 [95,100) 22 [100,HI)
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Apr 2024 19:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925871#M364329</guid>
      <dc:creator>PamG</dc:creator>
      <dc:date>2024-04-25T19:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: DATALINES: SAS truncating last character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925873#M364331</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA bins;
length binnum 8. bin_desc $10.;
INPUT binnum bin_desc $ @@;
FORMAT bin_desc $10.;
DATALINES;
1 [-20,-15) 2 [-5,0) 3 [0,5) 4 [5,10) 5 [10,15) 6 [15,20) 7 [20,25) 8 [25,30) 8 [30,35) 10 [35,40) 
11 [40,45) 12 [45,50) 13 [55,60) 14 [60,65) 15 [65,70) 16 [70,75) 17 [75,80) 18 [80,85) 19 [85,90) 
20 [90,95) 21 [95,100) 22 [100,HI)
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Formats control the display, at that point it is already read in. SAS defaults to 8 for characters so you want to specify a longer length.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used 10 in my code above.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/442038"&gt;@PamG&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This seems like a very simple thing but I just can't seem to get it write.&amp;nbsp; When using the code below, SAS is truncating the last character wherever variable length is greater than 9.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA bins;
INPUT binnum bin_desc $ @@;
FORMAT bin_desc $10.;
DATALINES;
1 [-20,-15) 2 [-5,0) 3 [0,5) 4 [5,10) 5 [10,15) 6 [15,20) 7 [20,25) 8 [25,30) 8 [30,35) 10 [35,40) 
11 [40,45) 12 [45,50) 13 [55,60) 14 [60,65) 15 [65,70) 16 [70,75) 17 [75,80) 18 [80,85) 19 [85,90) 
20 [90,95) 21 [95,100) 22 [100,HI)
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 20:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925873#M364331</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-04-25T20:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: DATALINES: SAS truncating last character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925874#M364332</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, how do I tell SAS to read more than 8 chararcters?</description>
      <pubDate>Thu, 25 Apr 2024 19:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925874#M364332</guid>
      <dc:creator>PamG</dc:creator>
      <dc:date>2024-04-25T19:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: DATALINES: SAS truncating last character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925878#M364334</link>
      <description>Sorry, looks like I pasted the wrong code above. See the edited post with the LENGTH statement. You can also use an INFORMAT statement though it's more of an implicit command than explicit with that method.</description>
      <pubDate>Thu, 25 Apr 2024 20:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925878#M364334</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-04-25T20:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: DATALINES: SAS truncating last character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925885#M364339</link>
      <description>Thank you so much Reeza!  I never thought of using LENGTH.</description>
      <pubDate>Thu, 25 Apr 2024 20:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925885#M364339</guid>
      <dc:creator>PamG</dc:creator>
      <dc:date>2024-04-25T20:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: DATALINES: SAS truncating last character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925888#M364341</link>
      <description>&lt;P&gt;An example with Informat&lt;/P&gt;
&lt;PRE&gt;DATA bins;
informat binnum f8. bin_desc $10.;
INPUT binnum bin_desc $ @@;
FORMAT bin_desc $10.;
DATALINES;
1 [-20,-15) 2 [-5,0) 3 [0,5) 4 [5,10) 5 [10,15) 6 [15,20) 7 [20,25) 8 [25,30) 8 [30,35) 10 [35,40) 
11 [40,45) 12 [45,50) 13 [55,60) 14 [60,65) 15 [65,70) 16 [70,75) 17 [75,80) 18 [80,85) 19 [85,90) 
20 [90,95) 21 [95,100) 22 [100,HI)
;
RUN;&lt;/PRE&gt;
&lt;P&gt;A warning with Datalines: Sometimes&amp;nbsp; you may have to specify the separator. That would be something like this if your values are separated by | characters (sometimes called a pipe).&lt;/P&gt;
&lt;PRE&gt;infile datalines delimiter='|';&lt;/PRE&gt;
&lt;P&gt;Another sneakier warning: If copying from some documents, word processor or spreadsheets being common culprits, you may have characters that you do not see that are used by those programs internally and your datalines can throw some odd errors. SAS is pretty good about telling you where something goes wrong but what may not be clear. If you see odd error or invalid data messages you may need to go to the data line with the error and delete what appears to be a space and then retype a space.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use ATTRIB statement to describe variables before they are read to set information used for reading.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 20:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DATALINES-SAS-truncating-last-character/m-p/925888#M364341</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-25T20:33:52Z</dc:date>
    </item>
  </channel>
</rss>

