<?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: Delete variables only if all are missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496655#M131393</link>
    <description>I want to delete the observations if all the variables mentioned in the&lt;BR /&gt;initial post are missing.&lt;BR /&gt;</description>
    <pubDate>Tue, 18 Sep 2018 17:15:31 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2018-09-18T17:15:31Z</dc:date>
    <item>
      <title>Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496541#M131352</link>
      <description>&lt;P&gt;I want to delete the variables only if all of them (INBNPR,INBINK,INBFRK) are missing using where clause. In this case I want the same output as I got in the previous dataset qisfr15 but I end up with 0 observations. Could you please guide me?&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 qisfr15;
INBNPR=0;
INBINK=2;
INBFRK=.;
run;

proc sql;
create table test as select * from qisfr15
where INBNPR ne . and INBINK ne . and INBFRK ne . ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&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;27         data qisfr15;
28         INBNPR=0;
29         INBINK=2;
30         INBFRK=.;
31         run;

NOTE: The data set WORK.QISFR15 has 1 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
      

32         
33         proc sql;
34         create table test as select * from qisfr15
2                                                          The SAS System                          11:55 Tuesday, September 18, 2018

35         where INBNPR ne . and INBINK ne . and INBFRK ne . ;
NOTE: Table WORK.TEST created, with 0 rows and 3 columns.

36         quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 13:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496541#M131352</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-09-18T13:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496551#M131354</link>
      <description>&lt;P&gt;Your query is keep the observations where it is true that ALL three variables are NOT missing, so if any of the three IS missing then exclude that observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to keep the observations where it is NOT true that ALL three variables are missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where not (INBNPR=. and INBINK=. and INBFRK=.)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Our you can use De Morgan's law and convert to an expression using OR instead.&amp;nbsp; So look for observations where at least one of them is not missing.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where INBNPR ne . or INBINK ne . or INBFRK ne .&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 13:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496551#M131354</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-18T13:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496557#M131357</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table test as select * from qisfr15
where nmiss(INBNPR,INBINK,INBFRK)&amp;lt;3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Sep 2018 13:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496557#M131357</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2018-09-18T13:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496559#M131359</link>
      <description>&lt;P&gt;Although you have asked to delete VARIABLES, your code and the code of the other people are deleting OBSERVATIONS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to delete VARIABLES? Or do you want to delete OBSERVATIONS?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 13:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496559#M131359</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-18T13:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496590#M131368</link>
      <description>If you want to check if all values of a variable are missing PROC FREQ with the NLEVELS data set is the best method. You cannot drop variables within a WHERE statement, you can only drop observations.</description>
      <pubDate>Tue, 18 Sep 2018 15:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496590#M131368</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T15:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496655#M131393</link>
      <description>I want to delete the observations if all the variables mentioned in the&lt;BR /&gt;initial post are missing.&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Sep 2018 17:15:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496655#M131393</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-09-18T17:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496656#M131394</link>
      <description>Then your code is correct.</description>
      <pubDate>Tue, 18 Sep 2018 17:20:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496656#M131394</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-18T17:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete variables only if all are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496779#M131477</link>
      <description>&lt;P&gt;In that case,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt;'s answer is the most elegant in my opinion.&lt;/P&gt;
&lt;P&gt;Also please change the post title to reflect your actual question (delete observations).&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:33:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-variables-only-if-all-are-missing/m-p/496779#M131477</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-09-18T22:33:12Z</dc:date>
    </item>
  </channel>
</rss>

