<?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: I want to drop observations but only if both variables are missing in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308835#M61209</link>
    <description>&lt;P&gt;I think the "where death_dt ne . AND dod ne .;" statement ends up excluding all observations with EITHER a missing death_dt or missing dod, which is not what I am looking to do. But this made me realize I was overthinking it. There may be a shorter way, but this code seems to work well by creating a new variable to work with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;if&lt;/SPAN&gt; death_dt = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt; and dod = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;then&lt;/SPAN&gt; death_missing = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;else&lt;/SPAN&gt; death_missing = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s4"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_NOTMISSING;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;where&lt;/SPAN&gt; death_missing = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s4"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2016 19:03:24 GMT</pubDate>
    <dc:creator>Kels123</dc:creator>
    <dc:date>2016-11-02T19:03:24Z</dc:date>
    <item>
      <title>I want to drop observations but only if both variables are missing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308814#M61203</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I merged two databases based on date of death to give myself a more complete mortality database (I was worried that some deaths were only recorded in one database but not the other). Now I want to subset this database so that if BOTH variables are missing for the same observation, that observation will be dropped. This is the same as saying that I don't have a recorded data of death in either mortality database, so I will assume that the person has not yet died and does not belong in my mortality database (should be dropped).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the following code, but I am not sure it translates to "drop the observation if both death_dt and dod are missing, otherwise keep":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_278SUBJECTS; &lt;SPAN class="s2"&gt;*n=674*;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;WHERE&lt;/SPAN&gt; DEATH_DT ne &lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt; or dod ne &lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s5"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s5"&gt;I also did some exploring to see if I could figure out how the coding was working in terms of reducing the sample size:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_278SUBJECTS; &lt;SPAN class="s2"&gt;*n=674*;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;WHERE&lt;/SPAN&gt; DEATH_DT ne &lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s5"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_278SUBJECTS; &lt;SPAN class="s2"&gt;*n=587*;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;WHERE&lt;/SPAN&gt; dod ne &lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s5"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s5"&gt;Please help! Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 18:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308814#M61203</guid>
      <dc:creator>Kels123</dc:creator>
      <dc:date>2016-11-02T18:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: I want to drop observations but only if both variables are missing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308820#M61206</link>
      <description>&lt;P&gt;change&amp;nbsp;&lt;SPAN class="s3"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN&gt; DEATH_DT ne &lt;/SPAN&gt;&lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; or dod ne &lt;/SPAN&gt;&lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;to&amp;nbsp;&lt;SPAN class="s3"&gt;WHERE&lt;/SPAN&gt;&lt;SPAN&gt; DEATH_DT ne &lt;/SPAN&gt;&lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; AND dod ne &lt;/SPAN&gt;&lt;SPAN class="s4"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 18:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308820#M61206</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-11-02T18:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: I want to drop observations but only if both variables are missing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308835#M61209</link>
      <description>&lt;P&gt;I think the "where death_dt ne . AND dod ne .;" statement ends up excluding all observations with EITHER a missing death_dt or missing dod, which is not what I am looking to do. But this made me realize I was overthinking it. There may be a shorter way, but this code seems to work well by creating a new variable to work with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;if&lt;/SPAN&gt; death_dt = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt; and dod = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s2"&gt;then&lt;/SPAN&gt; death_missing = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;else&lt;/SPAN&gt; death_missing = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s4"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/SPAN&gt; CLEAN.DEATH_NOTMISSING;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;SET&lt;/SPAN&gt; CLEAN.DEATH_BOTH;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s2"&gt;where&lt;/SPAN&gt; death_missing = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt; ;&lt;/P&gt;&lt;P class="p2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s4"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 19:03:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-want-to-drop-observations-but-only-if-both-variables-are/m-p/308835#M61209</guid>
      <dc:creator>Kels123</dc:creator>
      <dc:date>2016-11-02T19:03:24Z</dc:date>
    </item>
  </channel>
</rss>

