<?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: Got error msg saying &amp;quot;expecting a ;&amp;quot; when ive checked multiple times and am not missin in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866437#M342165</link>
    <description>&lt;P&gt;I believe you need to switch your "delete" &amp;amp; "if" statements around. See solution 1 below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included solutions 2 &amp;amp;3 that achieve the same result using different methods as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Modeller_0-1679876190710.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82076iE55DF5EB23998E3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Modeller_0-1679876190710.png" alt="Modeller_0-1679876190710.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 00:17:29 GMT</pubDate>
    <dc:creator>Modeller</dc:creator>
    <dc:date>2023-03-27T00:17:29Z</dc:date>
    <item>
      <title>Got error msg saying "expecting a ;" when ive checked multiple times and am not missing any</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866434#M342163</link>
      <description>&lt;P&gt;Apologies if I've put this in the wrong place, I'm completely new here but this seemed like the best forum based on the introductory channels' description.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I am working on a class assignment and trying to create two different subsets of my data: one with only renters included and one with only homeowner's included. My code that's not functioning is below, and I can supply more if needed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data RentersData;
	set FullData2;
	delete if RENTGRS=0;
run;&lt;/PRE&gt;&lt;P&gt;Basically I am trying to drop all observations from my data where gross rent payments (RENTGRS) are equal to 0 so that only renters are included. However, I keep getting an error message that says&amp;nbsp;&lt;SPAN&gt;ERROR 79-322: Expecting a ;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Adding a screenshot below of the error message just in case there's any important detail I may have ignored&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jkinkade7_0-1679875143744.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82074iCEA6A44575B7C19B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jkinkade7_0-1679875143744.png" alt="jkinkade7_0-1679875143744.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this is descriptive enough, I can provide additional info if necessary. Thank you&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 23:59:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866434#M342163</guid>
      <dc:creator>jkinkade7</dc:creator>
      <dc:date>2023-03-26T23:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Got error msg saying "expecting a ;" when ive checked multiple times and am not missin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866437#M342165</link>
      <description>&lt;P&gt;I believe you need to switch your "delete" &amp;amp; "if" statements around. See solution 1 below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included solutions 2 &amp;amp;3 that achieve the same result using different methods as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Modeller_0-1679876190710.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82076iE55DF5EB23998E3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Modeller_0-1679876190710.png" alt="Modeller_0-1679876190710.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 00:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866437#M342165</guid>
      <dc:creator>Modeller</dc:creator>
      <dc:date>2023-03-27T00:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Got error msg saying "expecting a ;" when ive checked multiple times and am not missin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866440#M342167</link>
      <description>&lt;P&gt;Thank you so much, Solution 1 worked perfectly. I appreciate the additional solution approaches as well because they look like a cleaner solution than what I was opting for, I think they will help me a lot in the future&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 00:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866440#M342167</guid>
      <dc:creator>jkinkade7</dc:creator>
      <dc:date>2023-03-27T00:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Got error msg saying "expecting a ;" when ive checked multiple times and am not missin</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866448#M342175</link>
      <description>&lt;P&gt;The DELETE statement does not allow any other text.&amp;nbsp; That is why SAS says you are missing a semicolon.&amp;nbsp; Your text looks like it was meant to be two statements.&amp;nbsp; A DELETE statement and subsetting IF statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;delete;
if RENTGRS=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But that would delete every observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to conditionally execute the DELETE statement then you can use an IF/THEN statement and code the DELETE statement as the statement to execute when the condition is true.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if RENTGRS=0 then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If instead you want to use a subsetting IF statement you will need to reverse the logic of condition since now you want to specify the condition for when to NOT delete the observation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if RENTGRS ne 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 01:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Got-error-msg-saying-quot-expecting-a-quot-when-ive-checked/m-p/866448#M342175</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-03-27T01:39:28Z</dc:date>
    </item>
  </channel>
</rss>

