<?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: What is wrong with my if, then, delete statement? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634379#M21212</link>
    <description>&lt;P&gt;Hi Melody,&lt;/P&gt;
&lt;P&gt;Glad that it helped. And now the last step for how these SAS Forums work: If an answer resolves your problem then accept it as solution. This not only shows everybody else that this question is answered, it also helps people searching&amp;nbsp; existing discussions for answers to quickly get to a post which provides a solution.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
    <pubDate>Tue, 24 Mar 2020 08:36:49 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-03-24T08:36:49Z</dc:date>
    <item>
      <title>What is wrong with my if, then, delete statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634362#M21204</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a new SAS user and am stumped on why my 'if then delete' statement is not working for the 'primary_site_labeled' variable.&lt;/P&gt;&lt;P&gt;Please see the attached PDF of my code.&lt;/P&gt;&lt;P&gt;I had the same problem with the 'age_recode_with_1_year_olds' variable, until I wrote a separate statement for each value that I wanted to be deleted, but I obviously don't want to write out every value for the 'primary_site_labeled' variable.&lt;/P&gt;&lt;P&gt;I also tried writing two statements (one with '&amp;lt;180' and the other with '&amp;gt;209') but then&amp;nbsp;it said that there were no observations in my data set (there should still be hundreds of thousands).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Melody&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 07:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634362#M21204</guid>
      <dc:creator>mkit8</dc:creator>
      <dc:date>2020-03-24T07:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with my if, then, delete statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634366#M21205</link>
      <description>&lt;P&gt;Welcome to the SAS Communities.&lt;/P&gt;
&lt;P&gt;Can you please post your code using the running man icon&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 461px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/37289i49AC1CFCBEF6249C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This gives us access to your code as properly formatted text so we can provide the amended code as answer without having to re-type it from some PDF. It's an easy fix.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 08:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634366#M21205</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-24T08:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with my if, then, delete statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634372#M21207</link>
      <description>&lt;P&gt;Ok, did the typing now. But please post next time code using the running man.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data save.new2;
  set save.new;
  if age_recode_with_1_year_olds in (0,1,2,3,4,29) then delete;
  else if 0&amp;lt;=primary_site_labeled&amp;lt;=179 then delete;
  else if 201&amp;lt;=primary_site_labeled&amp;lt;=809 then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also write it this way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data save.new2;
  set save.new;
  if age_recode_with_1_year_olds in (0,1,2,3,4,29) 
    or 0&amp;lt;=primary_site_labeled&amp;lt;=179 
    or 201&amp;lt;=primary_site_labeled&amp;lt;=809 then
    delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 08:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634372#M21207</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-24T08:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with my if, then, delete statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634376#M21209</link>
      <description>&lt;P&gt;Thank you so much, Patrick! That works perfectly. I appreciate your help.&lt;/P&gt;&lt;P&gt;I'll make sure to share my code properly next time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Melody&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 08:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634376#M21209</guid>
      <dc:creator>mkit8</dc:creator>
      <dc:date>2020-03-24T08:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with my if, then, delete statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634379#M21212</link>
      <description>&lt;P&gt;Hi Melody,&lt;/P&gt;
&lt;P&gt;Glad that it helped. And now the last step for how these SAS Forums work: If an answer resolves your problem then accept it as solution. This not only shows everybody else that this question is answered, it also helps people searching&amp;nbsp; existing discussions for answers to quickly get to a post which provides a solution.&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 08:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/What-is-wrong-with-my-if-then-delete-statement/m-p/634379#M21212</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-24T08:36:49Z</dc:date>
    </item>
  </channel>
</rss>

