<?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: proc SQL where statement - or operators in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680155#M205484</link>
    <description>&lt;P&gt;You where condition includes the&amp;nbsp;&amp;nbsp; test for&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; _illness_onset_dt ne ' '&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If _illness_onset_dt is a date value, it must be numeric, and should not be compared to a character value. &amp;nbsp; That means you should replace the ' ' with a dot, as in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;_illness_onset_dt ne .&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Aug 2020 00:49:10 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-08-29T00:49:10Z</dc:date>
    <item>
      <title>proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680130#M205474</link>
      <description>&lt;P&gt;In PROC SQL I'd like to set up this conditional statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where (not missing (var1) and not missing (var2))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;OR upcase (var2) contains 'text'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the where clause not allow the "OR" operator?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 21:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680130#M205474</guid>
      <dc:creator>kegallag</dc:creator>
      <dc:date>2020-08-28T21:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680131#M205475</link>
      <description>&lt;P&gt;OR is allowed in PROC SQL in the WHERE clause&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;What is the problem you are having? Can you show us the LOG of the entire PROC SQL step?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 22:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680131#M205475</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-28T22:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680134#M205476</link>
      <description>&lt;P&gt;Yes the WHERE clause will accept OR:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table junk as
   select * 
   from sashelp.class
   where name='John' or name='Alice'
   ;
quit;&lt;/PRE&gt;
&lt;PRE&gt;/* try*/&lt;BR /&gt;where (not missing (var1) and not missing (var2))
     OR ( upcase (var2) contains 'TEXT' )&lt;/PRE&gt;
&lt;P&gt;make sure that you compare upcased variables to upper case text and sometimes you need to pay attention to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to show your log from when you ran the code. Copy the entire proc sql code along with note, warning or messages from the LOG window and paste into a code box opened on the forum with the &amp;lt;/&amp;gt; to prevent the message window from reformatting stuff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may also have to provide examples of where you think the code is not working properly, as in values of the variables.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 22:10:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680134#M205476</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-28T22:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680135#M205477</link>
      <description>&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;create table X as&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select ....&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;from ....&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where (Symptomatic not in ("","Unknown") AND _illness_onset_dt ne ' ') OR upcase (INV_PROCESS_STATUS) contains 'COMPLETE'&lt;/P&gt;&lt;P&gt;and c.case = s.case_no&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: Expression using not equals (^=) has components that are of different data types.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 22:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680135#M205477</guid>
      <dc:creator>kegallag</dc:creator>
      <dc:date>2020-08-28T22:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680136#M205478</link>
      <description>&lt;P&gt;Thanks! I pasted the code snippet above. Essentially, I'm trying to evaluate with a WHERE statement in PROC SQL whether is a null in both (variable1 *AND* variable2) OR find a string in variable3).&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 22:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680136#M205478</guid>
      <dc:creator>kegallag</dc:creator>
      <dc:date>2020-08-28T22:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680138#M205479</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/343788"&gt;@kegallag&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;create table X as&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;select ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;from ....&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;where (Symptomatic not in ("","Unknown") AND _illness_onset_dt ne ' ') OR upcase (INV_PROCESS_STATUS) contains 'COMPLETE'&lt;/P&gt;
&lt;P&gt;and c.case = s.case_no&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ERROR: Expression using not equals (^=) has components that are of different data types.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please show us the LOG, &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;all of it&lt;/STRONG&gt;&lt;/FONT&gt;, with nothing chopped out, for this PROC SQL step.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 22:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680138#M205479</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-28T22:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680139#M205480</link>
      <description>&lt;P&gt;11811 proc sql;&lt;BR /&gt;11812 create table nmedss_complete_inv as&lt;BR /&gt;11813 select c.INV_PROCESS_STATUS as status, c.UPDATED_OUTCOME as outcome,&lt;BR /&gt;11813! c.MONITORING_PROCESS as process,&lt;BR /&gt;11814 c._INV_START_DT as investStartDate format mmddyy10., c._patient_id as&lt;BR /&gt;11814! nmedss_id, c.INV_LOCAL_ID, c.PATIENT_LAST_NAME as lastname, c.PATIENT_FIRST_NAME as&lt;BR /&gt;11814! firstname,&lt;BR /&gt;11815 c._patient_dob as dob, c.PATIENT_CURRENT_SEX as sex, c.PATIENT_STREET_ADDR_1 as&lt;BR /&gt;11815! address1, c.patient_city as city, c._combined_county as county,&lt;BR /&gt;11816 s.state_name as state, c.JURISDICTION_NM as jurisdiction, c.PATIENT_TEL_HOME as&lt;BR /&gt;11816! home_phone, c.PATIENT_TEL_CELL as cell_phone,&lt;BR /&gt;11817 c._nm_race_ethnicity as ethnicity, c.Tribal_affiliation, c.PHC_INV_LAST_NAME as&lt;BR /&gt;11817! investigator, c.ORDERING_FACILITY as orderfac, c.ltc_facility, c.ltc_status&lt;BR /&gt;11818 from covid19_complete c, states_fips s&lt;BR /&gt;11819&lt;BR /&gt;11820 where Symptomatic not in ("","Unknown") and _illness_onset_dt ne '' or upcase&lt;BR /&gt;11820! (INV_PROCESS_STATUS) contains 'COMPLETE'&lt;BR /&gt;11821 and c.patient_state = s.fips_code&lt;BR /&gt;11822 and JURISDICTION_NM not in ("NWTribal","Tribal","Federal Facility", "ICE Facility",&lt;BR /&gt;11822! "New Mexico Corrections Department")&lt;BR /&gt;11823 and _detention_facility=''&lt;BR /&gt;11824 and upcase(ltc_status) not in ('RESIDENT', 'UNKNOWN')&lt;BR /&gt;11825 and (upcase(PHC_INV_LAST_NAME) like '%CENTRAL%' or upcase(PHC_INV_LAST_NAME) like&lt;BR /&gt;11825! '%BAUMBACH%' or upcase(PHC_INV_LAST_NAME) like '%EKPE%'&lt;BR /&gt;11826 or upcase(PHC_INV_LAST_NAME) like '%FITZPATRICK%' or upcase(PHC_INV_LAST_NAME)&lt;BR /&gt;11826! like '%GARCIA-LOPEZ%'&lt;BR /&gt;11827 or upcase(PHC_INV_LAST_NAME) like '%ADMINISTRATIVE OFFICE%' or&lt;BR /&gt;11827! upcase(PHC_INV_LAST_NAME) like '%LAS CRUCES HEALTH%'&lt;BR /&gt;11828 or upcase(PHC_INV_LAST_NAME) like '%GALLUP%')&lt;BR /&gt;11829 and (upcase(orderfac) not like '%NAVAJO-%' and upcase(orderfac) not like&lt;BR /&gt;11829! '%CROWNPOINT%' and upcase(orderfac) not like '%CHINLE%'&lt;BR /&gt;11830 and upcase(orderfac) not like '%INDIAN HEALTH CENTER%' and upcase(orderfac) not&lt;BR /&gt;11830! like '%NORTHERN NAVAJO MED%' and upcase(orderfac) not like&lt;BR /&gt;11831 '%INDIAN HOSPITAL %' and upcase(orderfac) not like '%ZIA HEALTH %' and&lt;BR /&gt;11831! upcase(orderfac) not like '%AIH CLINICAL %' and&lt;BR /&gt;11832 upcase(orderfac) not like '%PUEBLO%');ERROR: Expression using not equals (^=) has components that are of different data types.&lt;BR /&gt;11833 quit;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;real time 14.17 seconds&lt;BR /&gt;cpu time 0.45 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 22:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680139#M205480</guid>
      <dc:creator>kegallag</dc:creator>
      <dc:date>2020-08-28T22:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680143#M205481</link>
      <description>&lt;PRE&gt;ERROR: Expression using not equals (^=) has components that are of different data types.&lt;/PRE&gt;
&lt;P&gt;Somewhere in your code, you are testing if a numeric variable (or value) is not equal to a character variable (or value), or vice versa. SAS does not allow such a comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So your task now is look at each place where you are comparing two variables (or a variable and a value) and determine where the mismatch is.&lt;/P&gt;
&lt;DIV id="tap-translate"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 28 Aug 2020 23:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680143#M205481</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-28T23:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680147#M205482</link>
      <description>&lt;P&gt;Somewhere in your WHERE condition you are either comparing a character column with a numeric constant or more likely a numeric column with a character constant (one enclosed in quotes). You need to check the type of all of the columns you've used in your WHERE - they will be either character or numeric - to identify which one(s) have a type mismatch.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Aug 2020 23:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680147#M205482</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-08-28T23:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc SQL where statement - or operators</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680155#M205484</link>
      <description>&lt;P&gt;You where condition includes the&amp;nbsp;&amp;nbsp; test for&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; _illness_onset_dt ne ' '&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If _illness_onset_dt is a date value, it must be numeric, and should not be compared to a character value. &amp;nbsp; That means you should replace the ' ' with a dot, as in&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;EM&gt;&lt;STRONG&gt;_illness_onset_dt ne .&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Aug 2020 00:49:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-SQL-where-statement-or-operators/m-p/680155#M205484</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-08-29T00:49:10Z</dc:date>
    </item>
  </channel>
</rss>

