<?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 Deleting observations with missing values using &amp;quot;if' statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-observations-with-missing-values-using-quot-if/m-p/607917#M176823</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's me again the student newbie in SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are quite a number of issues and answers around this question but I am not familiar with the proc sql yet. I merged two big data sets that I need to analyze but all of of the variables have missing data. I am just wondering if there is a way to delete them in one go using the if-then statements? Below is my code for your reference. Appreciate any assistance! Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename F1 'C:\Users\among\OneDrive\Desktop\Study1_1.txt';&lt;BR /&gt;data study1;&lt;BR /&gt;infile F1;&lt;BR /&gt;infile F1 dsd dlm=',';&lt;BR /&gt;infile F1 missover;&lt;BR /&gt;input Patient_ID Age State $ Length_of_Stay Total_Charge;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=study1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Filename F2 'C:\Users\among\OneDrive\Desktop\Study2_2.txt';&lt;BR /&gt;data study2;&lt;BR /&gt;infile F2;&lt;BR /&gt;infile F2 dsd dlm=',';&lt;BR /&gt;infile F2 missover;&lt;BR /&gt;input Patient_ID Group $ Test_Score;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=study2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sort data=study1;&lt;BR /&gt;by Patient_ID;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=study2;&lt;BR /&gt;by Patient_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data final;&lt;BR /&gt;merge study1 study2;&lt;BR /&gt;by Patient_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=final;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;successfully merged the data&amp;gt; but a lot of missing observations in all of the variables: Age State Length_of_Stay Total_Charge Group and Test_Score&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data final_1;&lt;BR /&gt;set final;&lt;BR /&gt;if Age=. then delete;&lt;BR /&gt;if State='' then delete;&lt;BR /&gt;if Length_of_Stay=. then delete;&lt;BR /&gt;if Total_Change=. then delete;&lt;BR /&gt;if Group='' then delete;&lt;BR /&gt;If Test_Score=. then delete;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it didn't work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Nov 2019 00:39:44 GMT</pubDate>
    <dc:creator>aongkeko</dc:creator>
    <dc:date>2019-11-28T00:39:44Z</dc:date>
    <item>
      <title>Deleting observations with missing values using "if' statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-observations-with-missing-values-using-quot-if/m-p/607917#M176823</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's me again the student newbie in SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are quite a number of issues and answers around this question but I am not familiar with the proc sql yet. I merged two big data sets that I need to analyze but all of of the variables have missing data. I am just wondering if there is a way to delete them in one go using the if-then statements? Below is my code for your reference. Appreciate any assistance! Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename F1 'C:\Users\among\OneDrive\Desktop\Study1_1.txt';&lt;BR /&gt;data study1;&lt;BR /&gt;infile F1;&lt;BR /&gt;infile F1 dsd dlm=',';&lt;BR /&gt;infile F1 missover;&lt;BR /&gt;input Patient_ID Age State $ Length_of_Stay Total_Charge;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=study1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Filename F2 'C:\Users\among\OneDrive\Desktop\Study2_2.txt';&lt;BR /&gt;data study2;&lt;BR /&gt;infile F2;&lt;BR /&gt;infile F2 dsd dlm=',';&lt;BR /&gt;infile F2 missover;&lt;BR /&gt;input Patient_ID Group $ Test_Score;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=study2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sort data=study1;&lt;BR /&gt;by Patient_ID;&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=study2;&lt;BR /&gt;by Patient_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data final;&lt;BR /&gt;merge study1 study2;&lt;BR /&gt;by Patient_ID;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc print data=final;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;successfully merged the data&amp;gt; but a lot of missing observations in all of the variables: Age State Length_of_Stay Total_Charge Group and Test_Score&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data final_1;&lt;BR /&gt;set final;&lt;BR /&gt;if Age=. then delete;&lt;BR /&gt;if State='' then delete;&lt;BR /&gt;if Length_of_Stay=. then delete;&lt;BR /&gt;if Total_Change=. then delete;&lt;BR /&gt;if Group='' then delete;&lt;BR /&gt;If Test_Score=. then delete;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it didn't work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2019 00:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-observations-with-missing-values-using-quot-if/m-p/607917#M176823</guid>
      <dc:creator>aongkeko</dc:creator>
      <dc:date>2019-11-28T00:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting observations with missing values using "if' statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-observations-with-missing-values-using-quot-if/m-p/607926#M176828</link>
      <description>First step:  combine the INFILE statements.  For example:&lt;BR /&gt;&lt;BR /&gt;infile F1 dsd missover;&lt;BR /&gt;&lt;BR /&gt;As it stands now, each statement replaces the earlier statement, instead of adding to it.</description>
      <pubDate>Thu, 28 Nov 2019 01:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-observations-with-missing-values-using-quot-if/m-p/607926#M176828</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-11-28T01:23:14Z</dc:date>
    </item>
  </channel>
</rss>

