<?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: Unable to read data in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563135#M10853</link>
    <description>&lt;P&gt;Thank you sir&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 02 Jun 2019 13:52:21 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2019-06-02T13:52:21Z</dc:date>
    <item>
      <title>Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563118#M10844</link>
      <description>&lt;P&gt;HI Experts Good Morning&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here I have dataset unable to read the data&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data trians_time;
input train_name $ 1-22  arrival 23-26  dept 27-32  total_hours 34-39;
informat arrival dept total_hours time5.;
format arrival dept total_hours time5.;
datalines;
VSKP GARIB RATH(12740)  20:30 04:06 07:36	
GODAVARI EXP(12728)  7:40 01:39 07:59
FALAKNUMA EXP(12704) 15:55 00:02 08:07
;
run;























&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Jun 2019 06:41:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563118#M10844</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-06-02T06:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563122#M10847</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The challenge with your current data as you posted it are:&lt;/P&gt;
&lt;P&gt;- You are using LIST input but the data doesn't start on the positions as defined in your INPUT statement&lt;/P&gt;
&lt;P&gt;- The data as posted doesn't have a fixed column position so you couldn't use LIST input&lt;/P&gt;
&lt;P&gt;- You want to read a string into variable "train_name" that has blanks in it. But then blanks are also the delimiter between columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So... before trying to provide you some code we need to be sure how your actual data looks like. Is it positional like your Input statement indicates or isn't it. Is the column delimiter really a blank or did something get lost when copying data around?&lt;/P&gt;
&lt;P&gt;Could you change the delimiter/your data? An other delimiter would make things much simpler to read. Looking at the code you've posted I assume you're a beginner so ideally we don't "start" reading data where we have to do specialty coding for which you're not really ready yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here how the code could look like when changing the column delimiter to a pipe character.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data trains_time;
  infile datalines dlm='|' dsd truncover;
  input train_name :$22. (arrival dept total_hours) (:time5.);
  format arrival dept total_hours time5.;
  datalines;
VSKP GARIB RATH(12740)|20:30|04:06|07:36 
GODAVARI EXP(12728)|7:40|01:39|07:59
FALAKNUMA EXP(12704)|15:55|00:02|08:07
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Jun 2019 08:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563122#M10847</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-06-02T08:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563128#M10848</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data trians_time;
input;
call scan(_infile_,-3,p,l,' ');
train_name=substr(_infile_,1,p-1);   
arrival=input(scan(_infile_,-3,' '),time5.);
dept=input(scan(_infile_,-2,' '),time5.);
total_hours=input(scan(_infile_,-1,' '),time5.);
drop p l;
format arrival dept total_hours time5.;
datalines;
VSKP GARIB RATH(12740)  20:30 04:06 07:36	
GODAVARI EXP(12728)  7:40 01:39 07:59
FALAKNUMA EXP(12704) 15:55 00:02 08:07
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 02 Jun 2019 11:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563128#M10848</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-06-02T11:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563134#M10852</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Sharp&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You for your brilliant coding skill&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could you please explain call scan(_infile_,p,l,' ')&lt;/P&gt;&lt;P&gt;this is the first time&amp;nbsp; logical syntax&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 13:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563134#M10852</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-06-02T13:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563135#M10853</link>
      <description>&lt;P&gt;Thank you sir&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jun 2019 13:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563135#M10853</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2019-06-02T13:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563175#M10861</link>
      <description>&lt;P&gt;The documentation for the call scan() routine is found &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0ecxfx00bn8i4n1vhh8up24ha6x.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 05:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563175#M10861</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-03T05:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563563#M10899</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp; Sharp&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank You for your brilliant coding skill&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you please explain call scan(_infile_,p,l,' ')&lt;/P&gt;
&lt;P&gt;this is the first time&amp;nbsp; logical syntax&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Anand&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;_INFILE_ is an automatic SAS variable that has the contents of the input buffer when executing an INPUT statement.&lt;/P&gt;
&lt;P&gt;So when needed you can examine or parse the entire input line using functions as needed.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 16:12:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563563#M10899</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-04T16:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to read data</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563566#M10901</link>
      <description>&lt;P&gt;Actually the original poster was using COLUMN input mode.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n13ejk9swz5vrbn0z34iazfrp0wp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n13ejk9swz5vrbn0z34iazfrp0wp.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Your code is using LIST input mode.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0lrz3gb7m9e4rn137op544ddg0v.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0lrz3gb7m9e4rn137op544ddg0v.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is that there is no way to combine COLUMN input mode and use of the TIME informat.&amp;nbsp; What is normally done is to use a mixed mode INPUT statement that has some COLUMN mode and some FORMATTED mode.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input train_name $ 1-22 @24 arrival time5.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&amp;nbsp;some COLUMN mode and some LIST mode. Either by attaching an INFORMAT to the variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input train_name $ 1-22 arrival;
informat arrival time.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or adding an in-line informat with the colon modifier to use LIST mode instead of FORMATTED mode.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input train_name $ 1-22 arrival :time.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that when using LIST mode you do not need to specify a WIDTH on the INFORMAT specification.&amp;nbsp; SAS will ignore the width and adjust to use the width of actual next set of characters in the input buffer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 16:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-read-data/m-p/563566#M10901</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-04T16:23:13Z</dc:date>
    </item>
  </channel>
</rss>

