<?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: Use FIRSTOBS option in INFILE statement reading multiple files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75543#M16276</link>
    <description>ok. I played around with it and it looks like i need to reset the eov variable. sort of like this:&lt;BR /&gt;
&lt;BR /&gt;
if _n_=1 or eov then do;&lt;BR /&gt;
 [...];&lt;BR /&gt;
eov=0;&lt;BR /&gt;
end;</description>
    <pubDate>Tue, 20 Apr 2010 07:35:40 GMT</pubDate>
    <dc:creator>niemannk</dc:creator>
    <dc:date>2010-04-20T07:35:40Z</dc:date>
    <item>
      <title>Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75538#M16271</link>
      <description>Hi, &lt;BR /&gt;
 I need to read many text files from a directory into a one SAS data set.&lt;BR /&gt;
 All the text files have the same varibles but different number of observation. &lt;BR /&gt;
 I've tried to use a wildcard into the INFILE and the program works ok:&lt;BR /&gt;
&lt;BR /&gt;
 data pippo;&lt;BR /&gt;
INFILE "C:\tmp\*.txt" &lt;BR /&gt;
     DLM=';' DSD missover  &lt;B&gt;FIRSTOBS=2&lt;/B&gt;;&lt;BR /&gt;
input A&lt;BR /&gt;
        B&lt;BR /&gt;
        C&lt;BR /&gt;
        &lt;span class="lia-unicode-emoji" title=":anguished_face:"&gt;😧&lt;/span&gt; $4.&lt;BR /&gt;
        E: $9.;  &lt;BR /&gt;
run;   &lt;BR /&gt;
&lt;BR /&gt;
The problem is that i have to read just since the second observation of every text file (becouse the first one are the titles), and if i use the FIRSTOBS option in the INFILE, it applies just for the first text file, but in the other one it reads all the obs.&lt;BR /&gt;
Do you know how i could apply the FIRSTOBS =2 in every text file?&lt;BR /&gt;
&lt;BR /&gt;
Thanks, &lt;BR /&gt;
Elena</description>
      <pubDate>Fri, 16 Apr 2010 10:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75538#M16271</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-16T10:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75539#M16272</link>
      <description>When reading with a wild card the files are treated as one stream.  There is an option EOV to detect the start of a new file.  You could test that variable and use programming logic to skip the first line of the file.&lt;BR /&gt;
&lt;BR /&gt;
You CAN use FIRSTOBS when reading the files with the FILEVAR option.  This requires creating a list of files to be read.&lt;BR /&gt;
&lt;BR /&gt;
You should consult the documentation regarding the details of these INFILE statement options.</description>
      <pubDate>Fri, 16 Apr 2010 11:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75539#M16272</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-04-16T11:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75540#M16273</link>
      <description>With the help of the option EOV i have got solve the problem&lt;BR /&gt;
&lt;BR /&gt;
Thank you!</description>
      <pubDate>Fri, 16 Apr 2010 12:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75540#M16273</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-16T12:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75541#M16274</link>
      <description>I would be curious to see the result. The way I understand EOV is that it changes from 0 to 1 as soon as it encounters a new file. So reading in more than two files the EOV variable cannot tell you when you start reading in the third file. Or am I wrong?</description>
      <pubDate>Mon, 19 Apr 2010 15:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75541#M16274</guid>
      <dc:creator>niemannk</dc:creator>
      <dc:date>2010-04-19T15:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75542#M16275</link>
      <description>niemannk &lt;BR /&gt;
 &lt;BR /&gt;
you're wrong&lt;BR /&gt;
 &lt;BR /&gt;
EOV is set when "reading after last record" occurs on any file and there is more data to follow, through "*" or file concatenation. So the EOV= flag is set after all files except the last.&lt;BR /&gt;
 &lt;BR /&gt;
  &lt;BR /&gt;
PeterC</description>
      <pubDate>Mon, 19 Apr 2010 16:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75542#M16275</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-19T16:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75543#M16276</link>
      <description>ok. I played around with it and it looks like i need to reset the eov variable. sort of like this:&lt;BR /&gt;
&lt;BR /&gt;
if _n_=1 or eov then do;&lt;BR /&gt;
 [...];&lt;BR /&gt;
eov=0;&lt;BR /&gt;
end;</description>
      <pubDate>Tue, 20 Apr 2010 07:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75543#M16276</guid>
      <dc:creator>niemannk</dc:creator>
      <dc:date>2010-04-20T07:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Use FIRSTOBS option in INFILE statement reading multiple files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75544#M16277</link>
      <description>The documentation is pretty clear on this one.  &lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
EOV=variable &lt;BR /&gt;
names a variable that SAS sets to 1 when the first record in a file in a series of&lt;BR /&gt;
concatenated files is read. The variable is set only after SAS encounters the next&lt;BR /&gt;
file. Like automatic variables, the EOV= variable is not written to the data set.&lt;BR /&gt;
&lt;BR /&gt;
Tip: Reset the EOV= variable back to 0 after SAS encounters each boundary. &lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 20 Apr 2010 12:18:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-FIRSTOBS-option-in-INFILE-statement-reading-multiple-files/m-p/75544#M16277</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-04-20T12:18:39Z</dc:date>
    </item>
  </channel>
</rss>

