<?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: confused about IF..IN () EQ then DELETE in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543426#M7708</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if casenum in (164,47,55,68,2,52,61,10,1,169) eq 0 then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is equivalent to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (casenum in (164,47,55,68,2,52,61,10,1,169)) = 0 then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which translates to&lt;/P&gt;
&lt;P&gt;"if the condition (casenum can be found in the list) is false, then remove the observation"&lt;/P&gt;
&lt;P&gt;which is the negation form of&lt;/P&gt;
&lt;P&gt;"if the condition is true, then keep the observation"&lt;/P&gt;
&lt;P&gt;which would be (in code)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (casenum in (164,47,55,68,2,52,61,10,1,169)) = 1 then output;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and that can be shortened to the subsetting if.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2019 07:34:42 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-03-15T07:34:42Z</dc:date>
    <item>
      <title>confused about IF..IN () EQ then DELETE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543412#M7702</link>
      <description>&lt;P&gt;I am a little bit confused about the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA myshortoutputfile; 
SET myoutputfile;
casenum = _N_;
IF casenum IN ( 164, 47, 55, 68, 2, 52, 61, 10, 1, 169) EQ 0
THEN DELETE;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;why do we need EQ 0 and THEN DELETE here? Isn't this code equal to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myshortoutputfile;
set myoutputfile;
casenum = _N_;
if casenum IN (164, 47, 55, 68, 2, 52, 61, 10, 1, 169);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 06:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543412#M7702</guid>
      <dc:creator>shonn2nd</dc:creator>
      <dc:date>2019-03-15T06:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: confused about IF..IN () EQ then DELETE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543418#M7705</link>
      <description>&lt;P&gt;Quick answer: not needed.&lt;/P&gt;
&lt;P&gt;And yes, your second code is valid and much better (less code, and the condition is simple and obvious to understand). The first code is just an attempt to obfuscate something simple, and an example for bad coding.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 06:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543418#M7705</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-15T06:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: confused about IF..IN () EQ then DELETE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543423#M7707</link>
      <description>&lt;P&gt;Hi KurtBremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you briefly talk about the logic of that weird code? what does that mean: if casenum is equal to one of the list and equal to zero then that case will be deleted?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 07:12:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543423#M7707</guid>
      <dc:creator>shonn2nd</dc:creator>
      <dc:date>2019-03-15T07:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: confused about IF..IN () EQ then DELETE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543426#M7708</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if casenum in (164,47,55,68,2,52,61,10,1,169) eq 0 then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is equivalent to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (casenum in (164,47,55,68,2,52,61,10,1,169)) = 0 then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which translates to&lt;/P&gt;
&lt;P&gt;"if the condition (casenum can be found in the list) is false, then remove the observation"&lt;/P&gt;
&lt;P&gt;which is the negation form of&lt;/P&gt;
&lt;P&gt;"if the condition is true, then keep the observation"&lt;/P&gt;
&lt;P&gt;which would be (in code)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (casenum in (164,47,55,68,2,52,61,10,1,169)) = 1 then output;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and that can be shortened to the subsetting if.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 07:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/confused-about-IF-IN-EQ-then-DELETE/m-p/543426#M7708</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-15T07:34:42Z</dc:date>
    </item>
  </channel>
</rss>

