<?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: Why is my WHERE statement ignored in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/795074#M32911</link>
    <description>&lt;P&gt;You need to whrite the code this way :&lt;/P&gt;&lt;P&gt;proc sort data=pg1.storm_summary out=storm_sort;&lt;BR /&gt;where Basin in("NA" "na");&lt;BR /&gt;by descending MaxWindMPH;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;or you can just modify the where instructions as: where Basin= 'NA' or Basin= 'na'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Feb 2022 21:52:23 GMT</pubDate>
    <dc:creator>Manal02</dc:creator>
    <dc:date>2022-02-08T21:52:23Z</dc:date>
    <item>
      <title>Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735117#M28653</link>
      <description>&lt;P&gt;After running this code, I am seeing all basins, not just NA or na. What am I doing wrong? It just doesn't make sense to me that&amp;nbsp; this would be ignored and there is no error to help me see why.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***********************************************************;&lt;BR /&gt;* Activity 3.06 *;&lt;BR /&gt;* 1) Modify the OUT= option in the PROC SORT statement *;&lt;BR /&gt;* to create a temporary table named STORM_SORT. *;&lt;BR /&gt;* 2) Complete the WHERE and BY statements to answer *;&lt;BR /&gt;* the following question: Which storm in the North *;&lt;BR /&gt;* Atlantic basin (NA or na) had the strongest *;&lt;BR /&gt;* MaxWindMPH? *;&lt;BR /&gt;***********************************************************;&lt;/P&gt;&lt;P&gt;proc sort data=pg1.storm_summary out=storm_sort;&lt;BR /&gt;where Basin = 'NA' or 'na';&lt;BR /&gt;by descending MaxWindMPH;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:07:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735117#M28653</guid>
      <dc:creator>cwarfield</dc:creator>
      <dc:date>2021-04-18T18:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735118#M28654</link>
      <description>&lt;P&gt;Your syntax is wrong.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where Basin = 'NA' or 'na';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;should be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where Basin = 'NA' or basin='na';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From now on, when your code isn't working, show us the LOG so we can see the code along with NOTEs, ERRORs and WARNINGs that appear in the log.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:12:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735118#M28654</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-18T18:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735119#M28655</link>
      <description>&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter dijitContentPaneSingleChild"&gt;&lt;DIV class="dijitBorderContainer dijitContainer row-fluid dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitAlignCenter dijitContentPaneSingleChild dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane"&gt;&lt;DIV class="tabs dijitBorderContainer dijitContainer sasStudioTabsParentContainer dijitLayoutContainer dojoDndSource dojoDndTarget dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasStudioTabsTabContainer sasStudioTabsTabContainerVertical sasStudioTabsTop dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer sasStudioTabsTabContainerChild dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dojoDndTarget dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer dojoDndContainerOver"&gt;&lt;DIV class="dijitTabContainer dijitTabContainerTop dijitContainer dijitLayoutContainer tabStrip-disabled sasSuiteTabs dijitBorderContainer-child dijitBorderContainer-dijitTabContainerTop dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV class="dijitTabPaneWrapper dijitTabContainerTop-container dijitAlignCenter"&gt;&lt;DIV class="dijitTabContainerTopChildWrapper dijitVisible"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitTabPane dijitTabContainerTop-child dijitTabContainerTop-dijitBorderContainer dijitLayoutContainer"&gt;&lt;DIV class="dijitBorderContainer dijitContainer dijitBorderContainer-child dijitBorderContainer-dijitBorderContainer dijitBorderContainerPane dijitAlignCenter dijitLayoutContainer"&gt;&lt;DIV class="dijitContentPane dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignCenter"&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;I've added the log, there are no warnings or errors. Basin is a character value, it is NA, na, SP, etc. There are a couple other options. All of them show in the output data so the where statement is being ignored.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 proc sort data=pg1.storm_summary out=storm_sort;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 where Basin='NA' or 'na';&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 by descending MaxWindMPH;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 3118 observations read from the data set PG1.STORM_SUMMARY.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;WHERE 1 /* an obviously TRUE WHERE clause */ ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.STORM_SORT has 3118 observations and 12 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;user cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;memory 2517.15k&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;OS Memory 32060.00k&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Timestamp 04/18/2021 06:12:26 PM&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Step Count 83 Switch Count 5&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Reclaims 296&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Voluntary Context Switches 23&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Block Output Operations 784&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;90&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="dijitContentPane statusBar dijitBorderContainer-child dijitBorderContainer-dijitContentPane dijitBorderContainerPane dijitAlignBottom"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735119#M28655</guid>
      <dc:creator>cwarfield</dc:creator>
      <dc:date>2021-04-18T18:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735120#M28656</link>
      <description>&lt;P&gt;Thank you. I see now that the variable has to be listed again for the boolean operator to apply for a where statement.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 18:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735120#M28656</guid>
      <dc:creator>cwarfield</dc:creator>
      <dc:date>2021-04-18T18:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735134#M28658</link>
      <description>&lt;P&gt;Another approach when comparing a single variable to a list of values is to use the IN operator:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where basin in ('NA' 'na');&lt;/P&gt;
&lt;P&gt;which is the same as multiple 'or'.&lt;/P&gt;
&lt;P&gt;Another considering the difference between the values listed to make the case consistent:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where upcase (basin) = 'NA';&lt;/P&gt;
&lt;P&gt;Which makes the value compared to the list all upper case. If you actually have other case differences like "nA" or "Na" this might be preferred.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Apr 2021 22:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/735134#M28658</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-18T22:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/795074#M32911</link>
      <description>&lt;P&gt;You need to whrite the code this way :&lt;/P&gt;&lt;P&gt;proc sort data=pg1.storm_summary out=storm_sort;&lt;BR /&gt;where Basin in("NA" "na");&lt;BR /&gt;by descending MaxWindMPH;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;or you can just modify the where instructions as: where Basin= 'NA' or Basin= 'na'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 21:52:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/795074#M32911</guid>
      <dc:creator>Manal02</dc:creator>
      <dc:date>2022-02-08T21:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my WHERE statement ignored</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/795079#M32912</link>
      <description>&lt;P&gt;Because the non empty string 'na' is considered TRUE by SAS.&lt;/P&gt;
&lt;P&gt;So your where condition reduces to WHERE (test1) or TRUE.&amp;nbsp; Which is always going to be TRUE.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 22:16:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Why-is-my-WHERE-statement-ignored/m-p/795079#M32912</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-02-08T22:16:01Z</dc:date>
    </item>
  </channel>
</rss>

