<?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 Selective Input statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76030#M16407</link>
    <description>Hi All&lt;BR /&gt;
For a case like in the example below:&lt;BR /&gt;
Is there an efficient and elegant way to tell the input statement that I only want to read the field after the second delimiter? &lt;BR /&gt;
Is there a way how I can avoid having to map and then drop columns a and b?&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  infile datalines dsd dlm='|' truncover;&lt;BR /&gt;
  input a $ b $ c $;&lt;BR /&gt;
  put c=;&lt;BR /&gt;
  drop a b;&lt;BR /&gt;
  datalines;&lt;BR /&gt;
aaaa|bbb|ccc||ee&lt;BR /&gt;
u|ww||yy|z&lt;BR /&gt;
1|222|3333333|4|5&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
Thanks, Patrick</description>
    <pubDate>Fri, 16 Oct 2009 08:23:50 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2009-10-16T08:23:50Z</dc:date>
    <item>
      <title>Selective Input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76030#M16407</link>
      <description>Hi All&lt;BR /&gt;
For a case like in the example below:&lt;BR /&gt;
Is there an efficient and elegant way to tell the input statement that I only want to read the field after the second delimiter? &lt;BR /&gt;
Is there a way how I can avoid having to map and then drop columns a and b?&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  infile datalines dsd dlm='|' truncover;&lt;BR /&gt;
  input a $ b $ c $;&lt;BR /&gt;
  put c=;&lt;BR /&gt;
  drop a b;&lt;BR /&gt;
  datalines;&lt;BR /&gt;
aaaa|bbb|ccc||ee&lt;BR /&gt;
u|ww||yy|z&lt;BR /&gt;
1|222|3333333|4|5&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
Thanks, Patrick</description>
      <pubDate>Fri, 16 Oct 2009 08:23:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76030#M16407</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-10-16T08:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76031#M16408</link>
      <description>Hi, if you just need C, you could parse directly from the input buffer, like this.&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile datalines dsd /* dlm='|' */ truncover;&lt;BR /&gt;
input /* a $ b $ c $ */;&lt;BR /&gt;
C=scan(_infile_,3,'|');&lt;BR /&gt;
put c=;&lt;BR /&gt;
/* drop a b; */&lt;BR /&gt;
datalines;&lt;BR /&gt;
aaaa|bbb|ccc||ee&lt;BR /&gt;
u|ww||yy|z&lt;BR /&gt;
1|222|3333333|4|5&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
be sure to prealocate a large enough length for the C var.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Fri, 16 Oct 2009 10:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76031#M16408</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-10-16T10:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76032#M16409</link>
      <description>[pre]&lt;BR /&gt;
19  data _null_;&lt;BR /&gt;
520     infile datalines dsd dlm='|' truncover;&lt;BR /&gt;
521     input @'|' @'|' c:$8.;&lt;BR /&gt;
522     put c=;&lt;BR /&gt;
523     list;&lt;BR /&gt;
524     datalines;&lt;BR /&gt;
&lt;BR /&gt;
c=ccc&lt;BR /&gt;
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;
525        aaaa|bbb|ccc||ee&lt;BR /&gt;
c=&lt;BR /&gt;
526        u|ww||yy|z&lt;BR /&gt;
c=3333333&lt;BR /&gt;
527        1|222|3333333|4|5&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 16 Oct 2009 11:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76032#M16409</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-10-16T11:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76033#M16410</link>
      <description>just use a KEEP.</description>
      <pubDate>Fri, 16 Oct 2009 18:02:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76033#M16410</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-10-16T18:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76034#M16411</link>
      <description>Thank you guys!&lt;BR /&gt;
&lt;BR /&gt;
Didn't think about the approach data _null_ took. Too bad that there is no such thing as a "repeater" (i.e. 5*@'|').&lt;BR /&gt;
&lt;BR /&gt;
Thanks, Patrick</description>
      <pubDate>Sat, 17 Oct 2009 01:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76034#M16411</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2009-10-17T01:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Selective Input statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76035#M16412</link>
      <description>Oh... but you code easily code that:&lt;BR /&gt;
&lt;BR /&gt;
%macro repeat(N);&lt;BR /&gt;
%do I=1 %to &amp;amp;N;&lt;BR /&gt;
@ '|'&lt;BR /&gt;
%end; &lt;BR /&gt;
%mend repeat;&lt;BR /&gt;
&lt;BR /&gt;
options mprint;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile datalines dsd dlm='|' truncover;&lt;BR /&gt;
input %repeat(2) c:$8.;&lt;BR /&gt;
put c=;&lt;BR /&gt;
list;&lt;BR /&gt;
datalines;&lt;BR /&gt;
aaaa|bbb|ccc||ee&lt;BR /&gt;
u|ww||yy|z&lt;BR /&gt;
1|222|3333333|4|5&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 19 Oct 2009 13:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-Input-statement/m-p/76035#M16412</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-10-19T13:31:39Z</dc:date>
    </item>
  </channel>
</rss>

