<?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: Modified List Input - possible to skip fields? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406711#M99071</link>
    <description>&lt;P&gt;I think good programming practice would require that you read the fields into variables with descriptive names indicating what the fields are supposed to contain and then drop them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do what I say, not what I do...&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2017 19:05:11 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2017-10-23T19:05:11Z</dc:date>
    <item>
      <title>Modified List Input - possible to skip fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406598#M99012</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm reading a pipe delimited text file&amp;nbsp;which has four fields per record with modified list input, and I want to somehow skip over the second and third field (which may be null).&amp;nbsp; Is this possible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data like:&lt;/P&gt;
&lt;PRE&gt;1|ignore me|ignore me too|10
2|ignoreme||20
3|||30&lt;/PRE&gt;
&lt;P&gt;I can get what I want if I include place holders on the input list for the fields I want to ignore, but it looks silly &amp;nbsp;i.e.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_: );
  infile "d:\junk\dummy.txt" dlm="|" dsd ;

  input 
    ID
    _Ignore1 : $1.
    _Ignore2 : $1.
    Value   : 8.
  ;

  put (ID Value)(=);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking there might be a pointer control which instead of moving a certain number of column, moves a number of fields.&amp;nbsp; Below pseudo-code:&lt;/P&gt;
&lt;PRE&gt;data want ;
  infile "d:\junk\dummy.txt" dlm="|" dsd ;

  input 
    ID
    +2col   /*pseudo code: skip two fields*/
    Value   : 8.
  ;

  put (ID Value)(=);
run;&lt;/PRE&gt;
&lt;P&gt;Is there anything like that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can get what I want from by scanning _infile_, i.e.:&lt;/P&gt;
&lt;PRE&gt;data want ;
  infile "d:\junk\dummy.txt" dlm="|" dsd ;

  input 
    ID : 8.
  ;

  Value=input(scan(_infile_,4,"|","M"),8.);
  put (ID Value)(=);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it seems like when you're doing list input (modified or not), it would be handy to have pointer controls that allow you to skip forward or backward by a number of fields,&amp;nbsp;similar to pointer controls that move a number of columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there something like that?&amp;nbsp; If not, is it a crazy idea?&amp;nbsp; (I don't do a lot of reading of text files).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 15:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406598#M99012</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-10-23T15:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Modified List Input - possible to skip fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406620#M99022</link>
      <description>&lt;P&gt;I think CALL SCAN can get you there:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0ecxfx00bn8i4n1vhh8up24ha6x.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0ecxfx00bn8i4n1vhh8up24ha6x.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 idea would be along these lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input ID @ ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use call scan ==&amp;gt; find the position of the third delimiter within _INFILE_ (or possibly the position of the fourth word), being careful to use the M option to treat consecutive delimiters as marking separate words&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input @ location_returned_by_call_scan&amp;nbsp; +1 value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I trust you&amp;nbsp;(as much as I trust myself, anyway) to fiddle with the options to get them working.&amp;nbsp; For example, I'm not sure whether you really need to add +1 in the INPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 16:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406620#M99022</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-23T16:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Modified List Input - possible to skip fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406628#M99028</link>
      <description>&lt;P&gt;Not that it is elegant but you can reuse names on an input statement.&lt;/P&gt;
&lt;P&gt;So if you are really really sure that you don't want fields 2 and 3 your example could be&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;ID&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Ignore : &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _Ignore : &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token keyword"&gt;Value&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp; : &lt;SPAN class="token number"&gt;8&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;drop _ignore; &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 16:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406628#M99028</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-23T16:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Modified List Input - possible to skip fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406711#M99071</link>
      <description>&lt;P&gt;I think good programming practice would require that you read the fields into variables with descriptive names indicating what the fields are supposed to contain and then drop them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do what I say, not what I do...&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 19:05:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406711#M99071</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-10-23T19:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Modified List Input - possible to skip fields?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406953#M99147</link>
      <description>&lt;PRE&gt;
Your first code is good enough. Why do you want more slick one ?
Hope you would like the following code .




data x;
infile cards dsd dlm='|';
input @;
_n_=findc(_infile_,'|','b');
input  id  @(_n_+1) score;
cards;
1|ignore me|ignore me too|10
2|ignoreme||20
3|||30
;
run;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Oct 2017 14:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modified-List-Input-possible-to-skip-fields/m-p/406953#M99147</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-10-24T14:14:09Z</dc:date>
    </item>
  </channel>
</rss>

