<?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: Writing an infile data  step that skips the first 20 characters of a .txt or .ascii file in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513738#M15977</link>
    <description>&lt;P&gt;We need more details.&lt;/P&gt;
&lt;P&gt;If the extra 20 characters are every record then just change your&amp;nbsp;@ cursor movement commands to account for the new location.&lt;/P&gt;
&lt;P&gt;If it is just on the first record that you need skip then change the input statement to NOT use specific columns.&amp;nbsp; Looks like you don't need them anyway.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data LIBNAME.POPULATION_INFILE;
  infile FILELOC1;
  if _n_=1 then input +20 @;
  input
   "SAMPLE-YEAR-MONTH"n 6.
   "SAMPLE-SOURCE"n 1.
   "COUNTY-CODE"n   $2.
   "COUNTY-DISTRICT-NBR"n $3.
   "CITY NAME"n           $40.
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Nov 2018 00:07:50 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-11-16T00:07:50Z</dc:date>
    <item>
      <title>Writing an infile data  step that skips the first 20 characters of a .txt or .ascii file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513729#M15975</link>
      <description>&lt;P&gt;Hello, I am writing an infile data step that that reads .ascii and .txt files with repeating lines of code for records.&amp;nbsp; However our population sample data files come with 20 character long header string specifying when and where it came from.&amp;nbsp; How do I instruct SAS to begin writing the input statement after skipping the first 20 characters ONLY ONCE?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data LIBNAME.POPULATION_INFILE;&lt;/P&gt;&lt;P&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; infile FILELOC1;&lt;/P&gt;&lt;P&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; input&lt;/P&gt;&lt;P&gt;@1 "SAMPLE-YEAR-MONTH"n 6.&lt;/P&gt;&lt;P&gt;@7 "SAMPLE-SOURCE"n 1.&lt;/P&gt;&lt;P&gt;@8 "COUNTY-CODE"n&amp;nbsp;&amp;nbsp; $2.&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/145066"&gt;@10&lt;/a&gt; "COUNTY-DISTRICT-NBR"n $3.&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83330"&gt;@13&lt;/a&gt; "CITY NAME"n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $40.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513729#M15975</guid>
      <dc:creator>Chiginsky</dc:creator>
      <dc:date>2018-11-15T23:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an infile data  step that skips the first 20 characters of a .txt or .ascii file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513737#M15976</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/246793"&gt;@Chiginsky&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello, I am writing an infile data step that that reads .ascii and .txt files with repeating lines of code for records.&amp;nbsp; However our population sample data files come with 20 character long header string specifying when and where it came from.&amp;nbsp; How do I instruct SAS to begin writing the input statement after skipping the first 20 characters ONLY ONCE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data LIBNAME.POPULATION_INFILE;&lt;/P&gt;
&lt;P&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; infile FILELOC1;&lt;/P&gt;
&lt;P&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; input&lt;/P&gt;
&lt;P&gt;@1 "SAMPLE-YEAR-MONTH"n 6.&lt;/P&gt;
&lt;P&gt;@7 "SAMPLE-SOURCE"n 1.&lt;/P&gt;
&lt;P&gt;@8 "COUNTY-CODE"n&amp;nbsp;&amp;nbsp; $2.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/145066"&gt;@10&lt;/a&gt; "COUNTY-DISTRICT-NBR"n $3.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83330"&gt;@13&lt;/a&gt; "CITY NAME"n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $40.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;if the obnoxious string is the first ROW of the data then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;infile FILELOC1 firstobs=2;&lt;/P&gt;
&lt;P&gt;should work. That tells SAS to start reading on the second line of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is not the case then show an actual example that looks like your data as there are several other ways and the actual content makes a difference. Copy text from the file including maybe 6 rows of data and paste into a code box opened with the forum's {I} icon to preserve actual text appearance as the main message windows reformat text.&lt;/P&gt;
&lt;P&gt;You might consider NOT using name literals as the code gets cumbersome quickly. You can name your variables what you like such as COUNTY_DISTRICT_NBR or CityName. Assign a LABEL to get column headers that look "nicer" when needed.&lt;/P&gt;
&lt;P&gt;label COUNTY_DISTRICT_NBR&amp;nbsp;= 'County District Number'; for example&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 00:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513737#M15976</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-16T00:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an infile data  step that skips the first 20 characters of a .txt or .ascii file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513738#M15977</link>
      <description>&lt;P&gt;We need more details.&lt;/P&gt;
&lt;P&gt;If the extra 20 characters are every record then just change your&amp;nbsp;@ cursor movement commands to account for the new location.&lt;/P&gt;
&lt;P&gt;If it is just on the first record that you need skip then change the input statement to NOT use specific columns.&amp;nbsp; Looks like you don't need them anyway.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data LIBNAME.POPULATION_INFILE;
  infile FILELOC1;
  if _n_=1 then input +20 @;
  input
   "SAMPLE-YEAR-MONTH"n 6.
   "SAMPLE-SOURCE"n 1.
   "COUNTY-CODE"n   $2.
   "COUNTY-DISTRICT-NBR"n $3.
   "CITY NAME"n           $40.
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 00:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513738#M15977</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-16T00:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Writing an infile data  step that skips the first 20 characters of a .txt or .ascii file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513937#M15980</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;However our population sample data files come with 20 character long header string specifying when and where it came from.&amp;nbsp; How do I instruct SAS to begin writing the input statement after skipping the first 20 characters ONLY ONCE?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;So do you need anything&amp;nbsp;from the first line? Can you use FIRSTOBS on the infile statement to specify start reading at the second line?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data LIBNAME.POPULATION_INFILE;

                infile FILELOC1 &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;firstobs=2 truncover&lt;/STRONG&gt;&lt;/FONT&gt;;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 16:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Writing-an-infile-data-step-that-skips-the-first-20-characters/m-p/513937#M15980</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-16T16:00:49Z</dc:date>
    </item>
  </channel>
</rss>

