<?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: Trouble reading the last variable from a colon delimited in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307935#M20821</link>
    <description>I'm using SAS EG 5.1.&lt;BR /&gt;The origin is UNIX, that's correct.&lt;BR /&gt;I don't know what you mean with " last character shown by CHAR ZONE and NUMR", can you explain it to me, please?</description>
    <pubDate>Fri, 28 Oct 2016 15:33:53 GMT</pubDate>
    <dc:creator>sleretrano</dc:creator>
    <dc:date>2016-10-28T15:33:53Z</dc:date>
    <item>
      <title>Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307899#M20814</link>
      <description>&lt;P&gt;I'm trying to read from a UNIX file whose rows look like this:&lt;/P&gt;&lt;PRE&gt;42000001251100:137224761:123272858:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:DW7 :P:CP :+002296660:+00000005300:+00000598760:+00000132500:+00000132500:+00000000000:+00000250000:  :00010101:ENC:20120314:ENC:20120215:0:502:00010101:20100914:20111027:+00000007300:119&lt;/PRE&gt;&lt;P&gt;Notice that after the last field there isn't a ':' delimiter. I checked in a text editor and there's no "end of line" (i.e. CRLF, CR,&amp;nbsp;LF).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I read from the file, everything works fine except for the last variable which always comes out empty.&lt;/P&gt;&lt;P&gt;It's not a lrecl issue, I've checked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I managed to fix this by doing the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;lrecl=500000

DLM=':'

missover DSD;

Input Var1-Var35 
        @350 Var36;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As the last variable (the thirty sixth one) starts at the position 350.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I was looking for a more elegant solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This a follow up from this question: &lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/td-p/307696" target="_blank"&gt;https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-from-Unix/td-p/307696&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 12:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307899#M20814</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T12:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307906#M20816</link>
      <description>&lt;P&gt;Firstly, that is not a semicolon delimited file, it is a colon delimited file. &amp;nbsp;Next, I ran this code:&lt;/P&gt;
&lt;PRE&gt;data want;
  infile "s:\temp\rob\a.txt" lrecl=500000 dlm=':' missover dsd;
  input Var1-Var36;
run;
&lt;/PRE&gt;
&lt;P&gt;And it imported that row you have given quite simply. &amp;nbsp;There are problems however as some of the variables have character data, those are not read in as the input defaults to numeric. &amp;nbsp;Also, if it is from Unix you might need to put the option termstr=, per the guidance given here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/14/178.html" target="_blank"&gt;http://support.sas.com/kb/14/178.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 13:09:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307906#M20816</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-28T13:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307907#M20817</link>
      <description>&lt;P&gt;Do you get a message that looks like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Invalid data for var36 in line 1 350-353.
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                      
1         42000001251100:137224761:123272858:+00000000000:+00000000000:+00000000000:+00000000000:+00000000000:
     101  +00000000000:+00000000000:+00000000000:+00000000000:+00000000000:DW7 :P:CP :+002296660:+00000005300:
     201  +00000598760:+00000132500:+00000132500:+00000000000:+00000250000:  :00010101:ENC:20120314:ENC:201202

     301  15:0:502:00010101:20100914:20111027:+00000007300:119. 353
    ZONE  33333333333333333333333333333333333323333333333333330
    NUMR  15A0A502A00010101A20100914A20111027AB00000007300A119D
var1=4.2000001E13 var2=137224761 var3=123272858 var4=0 var5=0 var6=0 var7=0 var8=0 var9=0 var10=0 var11=0 var12=0 var13=0 var14=DW7
var15=P var16=CP var17=2296660 var18=5300 var19=598760 var20=132500 var21=132500 var22=0 var23=250000 var24=  var25=10101 var26=ENC
var27=20120314 var28=ENC var29=20120215 var30=0 var31=502 var32=10101 var33=20100914 var34=20111027 var35=7300 var36=. _ERROR_=1
_N_=1&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Oct 2016 13:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307907#M20817</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-10-28T13:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307908#M20818</link>
      <description>I do! Know how to fix it?</description>
      <pubDate>Fri, 28 Oct 2016 13:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307908#M20818</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T13:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307909#M20819</link>
      <description>I don't understand why you point out that it's not a semicolon delimited file, what is the relevance of that?&lt;BR /&gt;I'm aware that some vars have characters, I can fix those. My issue is with the last variable. It doesn't work for me. I tried termstr=CR, termstr=CRLF and termstr=LF, nothing worked.</description>
      <pubDate>Fri, 28 Oct 2016 13:17:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307909#M20819</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T13:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307920#M20820</link>
      <description>&lt;P&gt;What is the last character shown by&amp;nbsp;CHAR &amp;nbsp;ZONE and NUMR.&amp;nbsp; In my example they are .0D displayed vertically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is your SAS version?&amp;nbsp; You are using some flavor of UNIX right?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 13:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307920#M20820</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-10-28T13:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307935#M20821</link>
      <description>I'm using SAS EG 5.1.&lt;BR /&gt;The origin is UNIX, that's correct.&lt;BR /&gt;I don't know what you mean with " last character shown by CHAR ZONE and NUMR", can you explain it to me, please?</description>
      <pubDate>Fri, 28 Oct 2016 15:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307935#M20821</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T15:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307938#M20822</link>
      <description>Nevermind, I had misread your reply. Let me get back to you.</description>
      <pubDate>Fri, 28 Oct 2016 15:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307938#M20822</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T15:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307943#M20823</link>
      <description>I'm sorry, I actually don't get that message. I did at some point get a similar one, but it's not the same and I don't get the rows with "NUMR" and "ZONE" behind. The similar message I got was because I formated a character variable as a number variable.</description>
      <pubDate>Fri, 28 Oct 2016 15:52:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307943#M20823</guid>
      <dc:creator>sleretrano</dc:creator>
      <dc:date>2016-10-28T15:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307945#M20824</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80979"&gt;@sleretrano&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BR /&gt;I don't know what you mean with " last character shown by CHAR ZONE and NUMR", can you explain it to me, please?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You said you received the message similar to mine.&amp;nbsp; I would be helpful if you show the message and the record dump.&amp;nbsp; I was asking what it the last character because in my example I made your input file a DOS file and told SAS it was UNIX so that '0d'x became part of the record not&amp;nbsp;TERMSTR.&amp;nbsp; I'm not saying this is your problem exactly you have not given enough information to determine the problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     301  15:0:502:00010101:20100914:20111027:+00000007300:119. 353
    ZONE  33333333333333333333333333333333333323333333333333330
    NUMR  15A0A502A00010101A20100914A20111027AB00000007300A119D

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here we can see that the last character is '0d'x carriage return.&amp;nbsp;&amp;nbsp; When a record with unprintable characters if displayed with the LIST statement (implied for invalid data) SAS prints the characters in the first line I called CHAR and unprintable characters are displayed with a dot.&amp;nbsp; Then under that ZONE and NUMR are the values displayed in HEX vertically.&amp;nbsp; ZONE is the first hex digit and NUMR is the second.&amp;nbsp; This display requires fixed with font to make sense.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 15:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/307945#M20824</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-10-28T15:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble reading the last variable from a colon delimited</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/308069#M20825</link>
      <description>&lt;PRE&gt;
Read it as character , Can it work ?

Input Var1-Var35 
        @350 Var36 : $20.;

If it was worked, then your termstr= is not right, try others like termstr=nl.

Or your file is stream file (not have row-end character),then you need other input method like:

Input Var1-Var35 
        @350 Var36 @@;
&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Oct 2016 05:27:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trouble-reading-the-last-variable-from-a-colon-delimited/m-p/308069#M20825</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-29T05:27:57Z</dc:date>
    </item>
  </channel>
</rss>

