<?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 Exclude Records when using Infile Statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624174#M183823</link>
    <description>&lt;P&gt;I want to exclude records where the question_caption is "indicate relationship" because the score_value is NULL. When I use the infile statement as is below, I get a warning that there is invalid data for&amp;nbsp;&amp;nbsp;score_value for those records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data outcome;
infile 'filepath\formname.csv' dlm=',' dsd firstobs=1 lrecl=1000;
input 
id :$50.
event_name :$50.
test_header_name :$50.
question_caption :$75.
score_value 
answer_value :$50.;
run;&lt;/PRE&gt;&lt;P&gt;Currently I am just using a data step (below) after that to exclude those records. But I would preference not bringing them in at all.&lt;/P&gt;&lt;PRE&gt;data outcome_b;
	set outcome;
	where question_caption notin ("Indicate relationship");
run;&lt;/PRE&gt;&lt;P&gt;Is there a way in my infile statement to exclude these records?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2020 14:04:35 GMT</pubDate>
    <dc:creator>ddavies</dc:creator>
    <dc:date>2020-02-12T14:04:35Z</dc:date>
    <item>
      <title>Exclude Records when using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624174#M183823</link>
      <description>&lt;P&gt;I want to exclude records where the question_caption is "indicate relationship" because the score_value is NULL. When I use the infile statement as is below, I get a warning that there is invalid data for&amp;nbsp;&amp;nbsp;score_value for those records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data outcome;
infile 'filepath\formname.csv' dlm=',' dsd firstobs=1 lrecl=1000;
input 
id :$50.
event_name :$50.
test_header_name :$50.
question_caption :$75.
score_value 
answer_value :$50.;
run;&lt;/PRE&gt;&lt;P&gt;Currently I am just using a data step (below) after that to exclude those records. But I would preference not bringing them in at all.&lt;/P&gt;&lt;PRE&gt;data outcome_b;
	set outcome;
	where question_caption notin ("Indicate relationship");
run;&lt;/PRE&gt;&lt;P&gt;Is there a way in my infile statement to exclude these records?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 14:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624174#M183823</guid>
      <dc:creator>ddavies</dc:creator>
      <dc:date>2020-02-12T14:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Records when using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624175#M183824</link>
      <description>&lt;P&gt;No. you cannot use the INFILE statement to filter the data.&amp;nbsp; But you can tell the &lt;STRONG&gt;data step&lt;/STRONG&gt; with the INFILE statement to filter the data after you have read it (so you have something to test!).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data outcome;
  infile 'filepath\formname.csv' dlm=',' dsd firstobs=1 lrecl=1000;
  input 
    id :$50.
    event_name :$50.
    test_header_name :$50.
    question_caption :$75.
    score_value 
    answer_value :$50.
  ;
  if question_caption not in ("Indicate relationship");
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Feb 2020 14:08:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624175#M183824</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-12T14:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Records when using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624178#M183827</link>
      <description>&lt;P&gt;Thanks for the quick answer, I was hoping to not get the warning at all but this works and saves a step. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 14:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624178#M183827</guid>
      <dc:creator>ddavies</dc:creator>
      <dc:date>2020-02-12T14:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Exclude Records when using Infile Statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624180#M183829</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309196"&gt;@ddavies&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the quick answer, I was hoping to not get the warning at all but this works and saves a step. Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you saying the CSV file you are reading someone typed the letters NULL when the value of SCORE was missing?&lt;/P&gt;
&lt;P&gt;You can use format modifiers to suppress ALL error messages when reading SCORE.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input ... score ??  ... ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or create a custom informat that maps the string NULL to whatever value you want.&amp;nbsp; You could map it missing or a special missing for example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
invalue null 'NULL'=.N ;
run;
....
input ... score :null32. ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 14:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exclude-Records-when-using-Infile-Statement/m-p/624180#M183829</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-12T14:24:06Z</dc:date>
    </item>
  </channel>
</rss>

