<?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: reading text file having variable and observation in same line .aslo need to read only specific in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405162#M98534</link>
    <description>&lt;P&gt;When I wrote&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Use the "little running man" icon to post code, so we can safely copy/paste and run it."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I didn't do it just because I was incredibly bored. That subwindow preserves all formatting, while the main posting window virtually eliminates it, making the code next to unreadable.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2017 10:50:56 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-10-18T10:50:56Z</dc:date>
    <item>
      <title>reading text file having variable and observation in same line .aslo need to read only specific line</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404727#M98372</link>
      <description>&lt;P&gt;i have few files in a directory (same format ).&lt;/P&gt;&lt;P&gt;sample file(all files are same just with different&amp;nbsp; records) (files attached)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File name.................................: abcdeeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.txt&lt;BR /&gt;created.....................: 01JAN1999 16:25:17&lt;BR /&gt;number..............................: 1234&lt;BR /&gt;name.................................: test&lt;BR /&gt;number1............................: 0010&lt;BR /&gt;xx..........................: xx&lt;BR /&gt;type...........................: 01&lt;BR /&gt;tmt ........................: 01&lt;BR /&gt;initials.........................: ha&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Start time and date.......................: 06OCT1999 16:31:25&lt;BR /&gt;task one...........................: 06OCT1999 16:31:38&lt;BR /&gt;task two...........................: 06OCT1999 16:32:42&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Available ............: 40&lt;/P&gt;&lt;P&gt;casr10......: 200.0&lt;BR /&gt;case1...........: 38&lt;BR /&gt;case2...........: 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New[(xx)^2]:type1&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;wrong&amp;nbsp; &amp;nbsp; &amp;nbsp;right&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;one&amp;nbsp; two&amp;nbsp; &amp;nbsp; one&amp;nbsp; &amp;nbsp; &amp;nbsp; two&lt;BR /&gt;AAA (1.1 - 6.0Hz):&amp;nbsp; &amp;nbsp;1.101 1.101&amp;nbsp; 1.111&amp;nbsp; &amp;nbsp;1.105&lt;BR /&gt;BBB (1.2 - 8.5Hz):&amp;nbsp; &amp;nbsp;1.782 1.101&amp;nbsp; 1.121&amp;nbsp; &amp;nbsp;1.106&lt;BR /&gt;CCC (1.3 - 12.5Hz): 1.403 1.101&amp;nbsp; 1.131&amp;nbsp; 1.107&lt;BR /&gt;DDD (1.4 - 30.0Hz): 1.714 1.101&amp;nbsp; 1.141&amp;nbsp; 1.108&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New[(xx)^2]: type2&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wrong&amp;nbsp; right&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; one two one two&lt;BR /&gt;AAA (1.1 - 6.0Hz):&amp;nbsp; &amp;nbsp;1.101&amp;nbsp; &amp;nbsp;1.101&amp;nbsp; 2.111&amp;nbsp; 6.105&lt;BR /&gt;BBB (1.2 - 8.5Hz):&amp;nbsp; &amp;nbsp;1.782&amp;nbsp; &amp;nbsp;1.101 3.121&amp;nbsp; 7.106&lt;BR /&gt;CCC (1.3 - 12.5Hz): 1.403&amp;nbsp; 1.101 4.131&amp;nbsp; 8.107&lt;BR /&gt;DDD (1.4 - 30.0Hz): 1.714&amp;nbsp; 1.101&amp;nbsp; 5.141&amp;nbsp; 9.108&lt;/P&gt;&lt;P&gt;completed at.....................: 06OCT1999 16:45:28&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am reading all files from a directory and trying to read below fields&lt;/P&gt;&lt;P&gt;#3&amp;nbsp;number as old_number&lt;/P&gt;&lt;P&gt;#5&amp;nbsp;&lt;SPAN&gt;number1 as new_num&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#7 type&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;#12 time time8.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then i want to read below fields&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;New[(xx)^2]:type1&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;wrong&amp;nbsp; &amp;nbsp; &amp;nbsp;right&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;one&amp;nbsp; two&amp;nbsp; &amp;nbsp; one&amp;nbsp; &amp;nbsp; &amp;nbsp; two&lt;BR /&gt;AAA (1.1 - 6.0Hz):&amp;nbsp; &amp;nbsp;1.101 1.101&amp;nbsp; 1.111&amp;nbsp; &amp;nbsp;1.105&lt;BR /&gt;BBB (1.2 - 8.5Hz):&amp;nbsp; &amp;nbsp;1.782 1.101&amp;nbsp; 1.121&amp;nbsp; &amp;nbsp;1.106&lt;BR /&gt;CCC (1.3 - 12.5Hz): 1.403 1.101&amp;nbsp; 1.131&amp;nbsp; 1.107&lt;BR /&gt;DDD (1.4 - 30.0Hz): 1.714 1.101&amp;nbsp; 1.141&amp;nbsp; 1.108&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;New[(xx)^2]: type2&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wrong&amp;nbsp; right&lt;BR /&gt;&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; one two one two&lt;BR /&gt;AAA (1.1 - 6.0Hz):&amp;nbsp; &amp;nbsp;1.101&amp;nbsp; &amp;nbsp;1.101&amp;nbsp; 2.111&amp;nbsp; 6.105&lt;BR /&gt;BBB (1.2 - 8.5Hz):&amp;nbsp; &amp;nbsp;1.782&amp;nbsp; &amp;nbsp;1.101 3.121&amp;nbsp; 7.106&lt;BR /&gt;CCC (1.3 - 12.5Hz): 1.403&amp;nbsp; 1.101 4.131&amp;nbsp; 8.107&lt;BR /&gt;DDD (1.4 - 30.0Hz): 1.714&amp;nbsp; 1.101&amp;nbsp; 5.141&amp;nbsp; 9.108&lt;/P&gt;&lt;P&gt;completed at.....................: 06OCT1999 16:45:28&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AAA_Type1_Right_ONE&amp;nbsp; &amp;nbsp; AAA_Type1_Right_TWO&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&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.111&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; &amp;nbsp; &amp;nbsp; 1.101&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AAA_Type2_Right_ONE&amp;nbsp; &amp;nbsp; AAA_Type2_Right_TWO&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2.111&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6.105&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BBB_Type1_Right_ONE&amp;nbsp; &amp;nbsp; BBB_Type1_Right_TWO&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;1.121&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.106&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BBB_Type2_Right_ONE&amp;nbsp; &amp;nbsp;&amp;nbsp;BBB_Type2_Right_TWO&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; 3.121&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7.106&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(and same for CCC and DDD for both type1 and type2)&lt;/SPAN&gt;&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;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&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;&lt;SPAN&gt;the final out will have should also have below fields + above mentioned fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;path&amp;nbsp; &amp;nbsp;,&amp;nbsp; &amp;nbsp;filename&amp;nbsp; &amp;nbsp;,nc ,size, date1, dname,old_number,new_number ,type, time&amp;nbsp; and fileds for AAA,BBB,CCC,DDD as mentioned above.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;my piece of code for reading all files from directory&amp;nbsp;in a sas dataset.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let x=test;&lt;BR /&gt;%let DELIM = ' ' ;&lt;BR /&gt;%let DELIM2 = '_' ;&lt;/P&gt;&lt;P&gt;filename DIRLIST pipe "dir /-c /q /t:c %bquote("C:\Users\Tanwar\Desktop\&amp;amp;x\*.txt")";&lt;BR /&gt;data xxx (DROP=dir_rec line);&lt;BR /&gt;length path filename $255 line $1024 nc $50;&lt;BR /&gt;retain path ;&lt;BR /&gt;infile DIRLIST length=reclen ;&lt;BR /&gt;input line $varying1024. reclen ;&lt;BR /&gt;if reclen = 0 then delete ;&lt;BR /&gt;if scan(line,1,&amp;amp;DELIM)='Volume'|scan(line,1,&amp;amp;DELIM)='Total'|scan(line,2,&amp;amp;DELIM)='File(s)'|scan(line,2,&amp;amp;DELIM)='Dir(s)' then delete;&lt;BR /&gt;dir_rec=upcase(scan(line,1,&amp;amp;DELIM))='DIRECTORY';&lt;BR /&gt;if dir_rec then path=left(substr(line,length("Directory of")+2)) ;&lt;BR /&gt;else do ;&lt;BR /&gt;size = input( scan( line, 3, &amp;amp;DELIM ) , best. ) ;&lt;BR /&gt;filename = scan( line, 5, &amp;amp;DELIM ) ;&lt;BR /&gt;if filename in ( '.' '..' ) then delete ;&lt;BR /&gt;if find(substr(filename,1,5),"_")&amp;gt;0 then do;&lt;BR /&gt;if find("&amp;amp;x","_")&amp;gt;0 then date1 = abs(input( scan( line, 6, &amp;amp;DELIM2 ), date9. ));&lt;BR /&gt;if find("&amp;amp;x","_")&amp;lt;=0 and find("&amp;amp;x","FPS")&amp;lt;=0 then date1 = abs(input( scan( line, 5, &amp;amp;DELIM2 ), date9. ));&lt;BR /&gt;if find("&amp;amp;x","FPS")&amp;gt;0 then date1 = abs(input( scan( line, 4, &amp;amp;DELIM2 ), date9. ));&lt;BR /&gt;end;&lt;BR /&gt;if find(substr(filename,1,5),"_")=0 then do;&lt;BR /&gt;if find("&amp;amp;x","_")&amp;gt;0 then date1 = abs(input( scan( line, 5, &amp;amp;DELIM2 ), date9. ));&lt;BR /&gt;if find("&amp;amp;x","_")&amp;lt;=0 and find("&amp;amp;x","FPS")&amp;lt;=0 then date1 = abs(input( scan( line, 4, &amp;amp;DELIM2 ), date9. ));&lt;BR /&gt;if find("&amp;amp;x","FPS")&amp;gt;0 then date1 = abs(input( scan( line, 4, &amp;amp;DELIM2 ), date9. ));&lt;BR /&gt;end;&lt;BR /&gt;end ;&lt;BR /&gt;nc="1";&lt;BR /&gt;run ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data yyyy;&lt;BR /&gt;set xxx;&lt;BR /&gt;if missing(filename) or find(filename,'Copy')&amp;gt;0 then delete;&lt;BR /&gt;dname=trim(left(path))||"\"||trim(left(filename));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 11:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404727#M98372</guid>
      <dc:creator>tabraz</dc:creator>
      <dc:date>2017-10-17T11:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404784#M98390</link>
      <description>&lt;P&gt;Does every file have a single instance of this report, or could there be a sequence of reports in one file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The basic algorithm looks like this&lt;/P&gt;
&lt;P&gt;- retain all your variables&lt;/P&gt;
&lt;P&gt;- read a line&lt;/P&gt;
&lt;P&gt;- if line starts with "File name", and file_name &amp;gt; " ", output; and reset all vars. set file_name to scan(line,2,':')&lt;/P&gt;
&lt;P&gt;- check line for appearance of keywords, and extract information as with file_name&lt;/P&gt;
&lt;P&gt;- if line starts with one of AAA,BBB,CCC,DDD, take scan(line,2,':') and then use input(scan(...,3),5.1) and input(scan(...,4),5.) to get the respective numerical values&lt;/P&gt;
&lt;P&gt;- at EOF, output (last group)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can read all text files in a directory in one sweep, using wildcards in the infile statement. The above algorithm can deal with that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 13:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404784#M98390</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-17T13:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404793#M98393</link>
      <description>&lt;P&gt;Here a very crude piece of code, tested with the contents of test1.txt:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
infile '$HOME/sascommunity/tabraz.txt' truncover end=eof;
input line $200.;
length
  type_flag $5
  file_name $100
  old_number
  new_num $4
  type $2
  time 8
  aaa_type1_right_one
  aaa_type1_right_two
  aaa_type2_right_one
  aaa_type2_right_two
  bbb_type1_right_one
  bbb_type1_right_two
  bbb_type2_right_one
  bbb_type2_right_two
  ccc_type1_right_one
  ccc_type1_right_two
  ccc_type2_right_one
  ccc_type2_right_two
  ddd_type1_right_one
  ddd_type1_right_two
  ddd_type2_right_one
  ddd_type2_right_two 8
;
format time datetime19.;
retain
  type_flag
  file_name 
  old_number
  new_num
  type
  time
  aaa_type1_right_one
  aaa_type1_right_two
  aaa_type2_right_one
  aaa_type2_right_two
  bbb_type1_right_one
  bbb_type1_right_two
  bbb_type2_right_one
  bbb_type2_right_two
  ccc_type1_right_one
  ccc_type1_right_two
  ccc_type2_right_one
  ccc_type2_right_two
  ddd_type1_right_one
  ddd_type1_right_two
  ddd_type2_right_one
  ddd_type2_right_two
;
if index(line,"File name") = 1
then do;
  if file_name &amp;gt; ' '
  then do;
    output;
    old_number = ' ';
  end;
  file_name = strip(scan(line,2,':'));
end;
select (substr(line,1,3));
  when ('AAA') do;
    line = scan(line,2,':');
    select (type_flag);
      when ('type1') do;
        aaa_type1_right_one = input(scan(line,3,'09'x),5.);
        aaa_type1_right_two = input(scan(line,4,'09'x),5.);
      end;
      when ('type2') do;
        aaa_type2_right_one = input(scan(line,3,'09'x),5.);
        aaa_type2_right_two = input(scan(line,4,'09'x),5.);
      end;
      otherwise;
    end;
  end;
  otherwise do;
    if index(line,'number') = 1
    then do;
      if old_number = ' '
      then old_number = strip(scan(line,2,':'));
      else new_num = strip(scan(line,2,':'));
    end;
    if index(line,'New[(xx)^2]') = 1 then type_flag = strip(scan(line,2,':'));
    if index(line,'created') = 1
    then do;
      line = strip(substr(line,indexc(line,':')+1));
      substr(line,10,1) = ':';
      time = input(line,datetime19.);
    end;
    if index(line,'type') = 1 then type = strip(scan(line,2,':'));
  end;
end;
if eof then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once can pack the 'AAA' branch into a macro, so that it has to be written only once.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 13:45:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404793#M98393</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-17T13:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404794#M98394</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Yes every file have a single instance of this report.File format and sequence remain same for all files.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2017 13:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404794#M98394</guid>
      <dc:creator>tabraz</dc:creator>
      <dc:date>2017-10-17T13:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404861#M98422</link>
      <description>&lt;P&gt;Thaks for reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i am trying to read&amp;nbsp; actual file to find more records in actual file after tuning the script&amp;nbsp; &amp;nbsp;its giving&amp;nbsp; wrong output i tried to debug it but not able find&amp;nbsp; solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am sharing the replica of actual file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fields that i need in out put :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;S_number as&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;S_number&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Sub_number as sub_number&amp;nbsp;&lt;/P&gt;&lt;P&gt;occ number as occc&lt;/P&gt;&lt;P&gt;imp as imp&lt;/P&gt;&lt;P&gt;imp start as imp_start&lt;/P&gt;&lt;P&gt;imp end as imp_end&amp;nbsp;&lt;/P&gt;&lt;P&gt;aaa_abli_limit_one&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;aaa_abli_limit_two&lt;BR /&gt;aaa_joyl&amp;nbsp;_limit_one&lt;BR /&gt;aaa_joyl&amp;nbsp;_limit_two&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aaa_toto&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;_&lt;/SPAN&gt;&lt;SPAN&gt;limit_one&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;aaa_toto&lt;/SPAN&gt;&lt;SPAN&gt;_&lt;/SPAN&gt;&lt;SPAN&gt;limit_two&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aaa_pipi_limit_one&lt;BR /&gt;aaa_pipi_limit_two&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aaa_rkrk_limit_one&lt;BR /&gt;aaa_rkrk&amp;nbsp;_limit_two&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for example&amp;nbsp; &amp;nbsp; &amp;nbsp;aaa_abli_limit_one&amp;nbsp; will have&amp;nbsp; &amp;nbsp; &amp;nbsp; 1.1&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;aaa_abli_limit_one&amp;nbsp; will have&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;1.1&lt;/SPAN&gt;&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;&lt;SPAN&gt;same for BBB,CCC,DDD.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;however i am trying to solve this.Your help on this is much appreciated.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 10:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/404861#M98422</guid>
      <dc:creator>tabraz</dc:creator>
      <dc:date>2017-10-20T10:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405108#M98517</link>
      <description>&lt;P&gt;Show the code you tried vs. the new example file. Use the "little running man" icon to post code, so we can safely copy/paste and run it.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 06:04:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405108#M98517</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-18T06:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405158#M98533</link>
      <description>&lt;P&gt;am sharing the sample code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However its not the actual code which i was using as was not saved .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;infile 'C:\Desktop\test\test5.txt' truncover end=eof;&lt;BR /&gt;input line $200.;&lt;BR /&gt;length&lt;BR /&gt;type_flag $5&lt;BR /&gt;file_name $100&lt;BR /&gt;S_number&lt;BR /&gt;Sub_number&lt;BR /&gt;occ $4&lt;BR /&gt;imp&lt;BR /&gt;imp_start&lt;BR /&gt;imp_end&lt;BR /&gt;aaa_abli_limit_one&lt;BR /&gt;aaa_abli_limit_two&lt;BR /&gt;aaa_joyl _limit_one&lt;BR /&gt;aaa_joyl _limit_two&lt;BR /&gt;/*aaa_toto _limit_one*/&lt;BR /&gt;/*aaa_toto_limit_two*/&lt;BR /&gt;/*aaa_pipi_limit_one*/&lt;BR /&gt;/*aaa_pipi_limit_two*/&lt;BR /&gt;/*aaa_rkrk_limit_one*/&lt;BR /&gt;/*aaa_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*bbb_abli_limit_one*/&lt;BR /&gt;/*bbb_abli_limit_two*/&lt;BR /&gt;/*bbb_joyl _limit_one*/&lt;BR /&gt;/*bbb_joyl _limit_two*/&lt;BR /&gt;/*bbb_toto _limit_one*/&lt;BR /&gt;/*bbb_toto_limit_two*/&lt;BR /&gt;/*bbb_pipi_limit_one*/&lt;BR /&gt;/*bbb_pipi_limit_two*/&lt;BR /&gt;/*bbb_rkrk_limit_one*/&lt;BR /&gt;/*bbb_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ccc_abli_limit_one*/&lt;BR /&gt;/*ccc_abli_limit_two*/&lt;BR /&gt;/*ccc_joyl _limit_one*/&lt;BR /&gt;/*ccc_joyl _limit_two*/&lt;BR /&gt;/*ccc_toto _limit_one*/&lt;BR /&gt;/*ccc_toto_limit_two*/&lt;BR /&gt;/*ccc_pipi_limit_one*/&lt;BR /&gt;/*ccc_pipi_limit_two*/&lt;BR /&gt;/*ccc_rkrk_limit_one*/&lt;BR /&gt;/*ccc_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ddd_abli_limit_one*/&lt;BR /&gt;/*ddd_abli_limit_two*/&lt;BR /&gt;/*ddd_joyl _limit_one*/&lt;BR /&gt;/*ddd_joyl _limit_two*/&lt;BR /&gt;/*ddd_toto _limit_one*/&lt;BR /&gt;/*ddd_toto_limit_two*/&lt;BR /&gt;/*ddd_pipi_limit_one*/&lt;BR /&gt;/*ddd_pipi_limit_two*/&lt;BR /&gt;/*ddd_rkrk_limit_one*/&lt;BR /&gt;/*ddd_rkrk _limit_two*/&lt;BR /&gt;8.&lt;BR /&gt;;&lt;BR /&gt;format imp_start datetime19.;&lt;BR /&gt;format imp_end datetime19.;&lt;BR /&gt;retain&lt;BR /&gt;type_flag&lt;BR /&gt;file_name&lt;BR /&gt;S_number&lt;BR /&gt;Sub_number&lt;BR /&gt;occ&lt;BR /&gt;imp&lt;BR /&gt;imp_start&lt;BR /&gt;imp_end&lt;BR /&gt;aaa_abli_limit_one&lt;BR /&gt;aaa_abli_limit_two&lt;BR /&gt;aaa_joyl_limit_one&lt;BR /&gt;aaa_joyl_limit_two&lt;BR /&gt;aaa_toto _limit_one&lt;BR /&gt;aaa_toto_limit_two&lt;BR /&gt;aaa_pipi_limit_one&lt;BR /&gt;aaa_pipi_limit_two&lt;BR /&gt;aaa_rkrk_limit_one&lt;BR /&gt;aaa_rkrk _limit_two&lt;BR /&gt;/**/&lt;BR /&gt;/*bbb_abli_limit_one*/&lt;BR /&gt;/*bbb_abli_limit_two*/&lt;BR /&gt;/*bbb_joyl _limit_one*/&lt;BR /&gt;/*bbb_joyl _limit_two*/&lt;BR /&gt;/*bbb_toto _limit_one*/&lt;BR /&gt;/*bbb_toto_limit_two*/&lt;BR /&gt;/*bbb_pipi_limit_one*/&lt;BR /&gt;/*bbb_pipi_limit_two*/&lt;BR /&gt;/*bbb_rkrk_limit_one*/&lt;BR /&gt;/*bbb_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ccc_abli_limit_one*/&lt;BR /&gt;/*ccc_abli_limit_two*/&lt;BR /&gt;/*ccc_joyl _limit_one*/&lt;BR /&gt;/*ccc_joyl _limit_two*/&lt;BR /&gt;/*ccc_toto _limit_one*/&lt;BR /&gt;/*ccc_toto_limit_two*/&lt;BR /&gt;/*ccc_pipi_limit_one*/&lt;BR /&gt;/*ccc_pipi_limit_two*/&lt;BR /&gt;/*ccc_rkrk_limit_one*/&lt;BR /&gt;/*ccc_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ddd_abli_limit_one*/&lt;BR /&gt;/*ddd_abli_limit_two*/&lt;BR /&gt;/*ddd_joyl _limit_one*/&lt;BR /&gt;/*ddd_joyl _limit_two*/&lt;BR /&gt;/*ddd_toto _limit_one*/&lt;BR /&gt;/*ddd_toto_limit_two*/&lt;BR /&gt;/*ddd_pipi_limit_one*/&lt;BR /&gt;/*ddd_pipi_limit_two*/&lt;BR /&gt;/*ddd_rkrk_limit_one*/&lt;BR /&gt;/*ddd_rkrk _limit_two*/&lt;BR /&gt;8.&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;if index(line,"File name") = 1&lt;BR /&gt;then do;&lt;BR /&gt;if file_name &amp;gt; ' '&lt;BR /&gt;then do;&lt;BR /&gt;output;&lt;BR /&gt;S_number = ' ';&lt;BR /&gt;end;&lt;BR /&gt;file_name = strip(scan(line,2,':'));&lt;BR /&gt;end;&lt;BR /&gt;select (substr(line,1,5));&lt;BR /&gt;when ('abli') do;&lt;BR /&gt;line = scan(line,3,':');&lt;BR /&gt;select (type_flag);&lt;BR /&gt;when ('delta') do;&lt;BR /&gt;aaa_abli_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_abli_limit_one= input(scan(line,4,'09'x),5.);&lt;BR /&gt;end;&lt;BR /&gt;when ('joyl') do;&lt;BR /&gt;aaa_joyl_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_joyl_limit_two = input(scan(line,4,'09'x),5.);&lt;/P&gt;&lt;P&gt;when ('toto_') do;&lt;BR /&gt;aaa_toto_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_toto_limit_two = input(scan(line,4,'09'x),5.);&lt;BR /&gt;&lt;BR /&gt;when ('pipi') do;&lt;BR /&gt;aaa_pipi_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_pipi_limit_two = input(scan(line,4,'09'x),5.);&lt;BR /&gt;when ('rkrk') do;&lt;BR /&gt;aaa_rkrk_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_rkrk_limit_two = input(scan(line,4,'09'x),5.);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;/* /same for other BBB,CCC,DDD/*/&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;otherwise do;&lt;BR /&gt;if index(line,'S_number ') = 1&lt;BR /&gt;then do;&lt;BR /&gt;if Study_nr = ' '&lt;BR /&gt;then S_number = strip(scan(line,2,':'));&lt;BR /&gt;if index(line,'Subject number') = 1&lt;BR /&gt;then Sub_number= strip(scan(line,5,':'));&lt;BR /&gt;end;&lt;BR /&gt;if index(line,'play [(uV)^2]') = 1 then type_flag = strip(scan(line,2,':'));&lt;BR /&gt;if index(line,'Date and time created') = 1&lt;BR /&gt;then do;&lt;BR /&gt;line = strip(substr(line,indexc(line,':')+1));&lt;BR /&gt;substr(line,10,1) = ':';&lt;BR /&gt;imp_start = input(line,datetime19.);&lt;BR /&gt;substr(line,11,1) = ':';&lt;BR /&gt;imp_start = input(line,datetime19.);&lt;BR /&gt;substr(line,19,1) = ':';&lt;BR /&gt;imp = input(line,datetime19.);&lt;BR /&gt;end;&lt;BR /&gt;if index(line,'Occasion') = 1 then Occasion = strip(scan(line,2,':'));&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;if eof then output;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 10:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405158#M98533</guid>
      <dc:creator>tabraz</dc:creator>
      <dc:date>2017-10-18T10:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405162#M98534</link>
      <description>&lt;P&gt;When I wrote&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Use the "little running man" icon to post code, so we can safely copy/paste and run it."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I didn't do it just because I was incredibly bored. That subwindow preserves all formatting, while the main posting window virtually eliminates it, making the code next to unreadable.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 10:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405162#M98534</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-18T10:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405182#M98537</link>
      <description>&lt;P&gt;data want;&lt;BR /&gt;infile 'C:\Desktop\test\test5.txt' truncover end=eof;&lt;BR /&gt;input line $200.;&lt;BR /&gt;length&lt;BR /&gt;type_flag $5&lt;BR /&gt;file_name $100&lt;BR /&gt;S_number&lt;BR /&gt;Sub_number&lt;BR /&gt;occ $4&lt;BR /&gt;imp&lt;BR /&gt;imp_start&lt;BR /&gt;imp_end&lt;BR /&gt;aaa_abli_limit_one&lt;BR /&gt;aaa_abli_limit_two&lt;BR /&gt;aaa_joyl _limit_one&lt;BR /&gt;aaa_joyl _limit_two&lt;BR /&gt;/*aaa_toto _limit_one*/&lt;BR /&gt;/*aaa_toto_limit_two*/&lt;BR /&gt;/*aaa_pipi_limit_one*/&lt;BR /&gt;/*aaa_pipi_limit_two*/&lt;BR /&gt;/*aaa_rkrk_limit_one*/&lt;BR /&gt;/*aaa_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*bbb_abli_limit_one*/&lt;BR /&gt;/*bbb_abli_limit_two*/&lt;BR /&gt;/*bbb_joyl _limit_one*/&lt;BR /&gt;/*bbb_joyl _limit_two*/&lt;BR /&gt;/*bbb_toto _limit_one*/&lt;BR /&gt;/*bbb_toto_limit_two*/&lt;BR /&gt;/*bbb_pipi_limit_one*/&lt;BR /&gt;/*bbb_pipi_limit_two*/&lt;BR /&gt;/*bbb_rkrk_limit_one*/&lt;BR /&gt;/*bbb_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ccc_abli_limit_one*/&lt;BR /&gt;/*ccc_abli_limit_two*/&lt;BR /&gt;/*ccc_joyl _limit_one*/&lt;BR /&gt;/*ccc_joyl _limit_two*/&lt;BR /&gt;/*ccc_toto _limit_one*/&lt;BR /&gt;/*ccc_toto_limit_two*/&lt;BR /&gt;/*ccc_pipi_limit_one*/&lt;BR /&gt;/*ccc_pipi_limit_two*/&lt;BR /&gt;/*ccc_rkrk_limit_one*/&lt;BR /&gt;/*ccc_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ddd_abli_limit_one*/&lt;BR /&gt;/*ddd_abli_limit_two*/&lt;BR /&gt;/*ddd_joyl _limit_one*/&lt;BR /&gt;/*ddd_joyl _limit_two*/&lt;BR /&gt;/*ddd_toto _limit_one*/&lt;BR /&gt;/*ddd_toto_limit_two*/&lt;BR /&gt;/*ddd_pipi_limit_one*/&lt;BR /&gt;/*ddd_pipi_limit_two*/&lt;BR /&gt;/*ddd_rkrk_limit_one*/&lt;BR /&gt;/*ddd_rkrk _limit_two*/&lt;BR /&gt;8.&lt;BR /&gt;;&lt;BR /&gt;format imp_start datetime19.;&lt;BR /&gt;format imp_end datetime19.;&lt;BR /&gt;retain&lt;BR /&gt;type_flag&lt;BR /&gt;file_name&lt;BR /&gt;S_number&lt;BR /&gt;Sub_number&lt;BR /&gt;occ&lt;BR /&gt;imp&lt;BR /&gt;imp_start&lt;BR /&gt;imp_end&lt;BR /&gt;aaa_abli_limit_one&lt;BR /&gt;aaa_abli_limit_two&lt;BR /&gt;aaa_joyl_limit_one&lt;BR /&gt;aaa_joyl_limit_two&lt;BR /&gt;aaa_toto _limit_one&lt;BR /&gt;aaa_toto_limit_two&lt;BR /&gt;aaa_pipi_limit_one&lt;BR /&gt;aaa_pipi_limit_two&lt;BR /&gt;aaa_rkrk_limit_one&lt;BR /&gt;aaa_rkrk _limit_two&lt;BR /&gt;/**/&lt;BR /&gt;/*bbb_abli_limit_one*/&lt;BR /&gt;/*bbb_abli_limit_two*/&lt;BR /&gt;/*bbb_joyl _limit_one*/&lt;BR /&gt;/*bbb_joyl _limit_two*/&lt;BR /&gt;/*bbb_toto _limit_one*/&lt;BR /&gt;/*bbb_toto_limit_two*/&lt;BR /&gt;/*bbb_pipi_limit_one*/&lt;BR /&gt;/*bbb_pipi_limit_two*/&lt;BR /&gt;/*bbb_rkrk_limit_one*/&lt;BR /&gt;/*bbb_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ccc_abli_limit_one*/&lt;BR /&gt;/*ccc_abli_limit_two*/&lt;BR /&gt;/*ccc_joyl _limit_one*/&lt;BR /&gt;/*ccc_joyl _limit_two*/&lt;BR /&gt;/*ccc_toto _limit_one*/&lt;BR /&gt;/*ccc_toto_limit_two*/&lt;BR /&gt;/*ccc_pipi_limit_one*/&lt;BR /&gt;/*ccc_pipi_limit_two*/&lt;BR /&gt;/*ccc_rkrk_limit_one*/&lt;BR /&gt;/*ccc_rkrk _limit_two*/&lt;BR /&gt;/**/&lt;BR /&gt;/*ddd_abli_limit_one*/&lt;BR /&gt;/*ddd_abli_limit_two*/&lt;BR /&gt;/*ddd_joyl _limit_one*/&lt;BR /&gt;/*ddd_joyl _limit_two*/&lt;BR /&gt;/*ddd_toto _limit_one*/&lt;BR /&gt;/*ddd_toto_limit_two*/&lt;BR /&gt;/*ddd_pipi_limit_one*/&lt;BR /&gt;/*ddd_pipi_limit_two*/&lt;BR /&gt;/*ddd_rkrk_limit_one*/&lt;BR /&gt;/*ddd_rkrk _limit_two*/&lt;BR /&gt;8.&lt;BR /&gt;&lt;BR /&gt;;&lt;BR /&gt;if index(line,"File name") = 1&lt;BR /&gt;then do;&lt;BR /&gt;if file_name &amp;gt; ' '&lt;BR /&gt;then do;&lt;BR /&gt;output;&lt;BR /&gt;S_number = ' ';&lt;BR /&gt;end;&lt;BR /&gt;file_name = strip(scan(line,2,':'));&lt;BR /&gt;end;&lt;BR /&gt;select (substr(line,1,5));&lt;BR /&gt;when ('abli') do;&lt;BR /&gt;line = scan(line,3,':');&lt;BR /&gt;select (type_flag);&lt;BR /&gt;when ('delta') do;&lt;BR /&gt;aaa_abli_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_abli_limit_one= input(scan(line,4,'09'x),5.);&lt;BR /&gt;end;&lt;BR /&gt;when ('joyl') do;&lt;BR /&gt;aaa_joyl_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_joyl_limit_two = input(scan(line,4,'09'x),5.);&lt;/P&gt;&lt;P&gt;when ('toto_') do;&lt;BR /&gt;aaa_toto_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_toto_limit_two = input(scan(line,4,'09'x),5.);&lt;BR /&gt;&lt;BR /&gt;when ('pipi') do;&lt;BR /&gt;aaa_pipi_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_pipi_limit_two = input(scan(line,4,'09'x),5.);&lt;BR /&gt;when ('rkrk') do;&lt;BR /&gt;aaa_rkrk_limit_one = input(scan(line,3,'09'x),5.);&lt;BR /&gt;aaa_rkrk_limit_two = input(scan(line,4,'09'x),5.);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;/* /same for other BBB,CCC,DDD/*/&lt;BR /&gt;otherwise;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;otherwise do;&lt;BR /&gt;if index(line,'S_number ') = 1&lt;BR /&gt;then do;&lt;BR /&gt;if Study_nr = ' '&lt;BR /&gt;then S_number = strip(scan(line,2,':'));&lt;BR /&gt;if index(line,'Subject number') = 1&lt;BR /&gt;then Sub_number= strip(scan(line,5,':'));&lt;BR /&gt;end;&lt;BR /&gt;if index(line,'play [(uV)^2]') = 1 then type_flag = strip(scan(line,2,':'));&lt;BR /&gt;if index(line,'Date and time created') = 1&lt;BR /&gt;then do;&lt;BR /&gt;line = strip(substr(line,indexc(line,':')+1));&lt;BR /&gt;substr(line,10,1) = ':';&lt;BR /&gt;imp_start = input(line,datetime19.);&lt;BR /&gt;substr(line,11,1) = ':';&lt;BR /&gt;imp_start = input(line,datetime19.);&lt;BR /&gt;substr(line,19,1) = ':';&lt;BR /&gt;imp = input(line,datetime19.);&lt;BR /&gt;end;&lt;BR /&gt;if index(line,'Occasion') = 1 then Occasion = strip(scan(line,2,':'));&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;if eof then output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 12:35:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405182#M98537</guid>
      <dc:creator>tabraz</dc:creator>
      <dc:date>2017-10-18T12:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: reading text file having variable and observation in same line .aslo need to read only specific</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405917#M98779</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I managed to read the file &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 10:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-text-file-having-variable-and-observation-in-same-line/m-p/405917#M98779</guid>
      <dc:creator>tabraz</dc:creator>
      <dc:date>2017-10-20T10:44:24Z</dc:date>
    </item>
  </channel>
</rss>

