<?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 Expression using IN has components that are of different data types in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766966#M80997</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I keep getting error messages on the IN condition in my sas code, cannot figure out what went wrong. Any feedback would be appreciated!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE GR_SCH AS
SELECT SUM(C.STU_SECTN_CRED) AS SCH
FROM SID.SID_COURSES_TAKEN C
WHERE C.TERMID IN ('202005', '202008', '202101') AND C.BENCH='E' AND C.CRS_NBR &amp;gt; '4999'
      AND (C.CIP_CRS NOT IN ('511201', '513818', '512308', '512001') OR 
           C.OASIS_PIDM IN 
              (SELECT NEW_VAL
               FROM DWHOUSE.HUB_XREF_RULE_V_D3 R
               WHERE R.SOURCE_NAME = 'HUB' AND R.KEY_WORD = 'IPEDS'
                AND R.QUALIFIER = '12M_EX_IN' AND R.IN_VAL1 = '20202021'
                AND R.IN_VAL2 = '1USF' AND R.EFFECTIVE_STATUS = 'A'
                AND R.EFFECTIVE_DATE =
                    (SELECT MAX(F.EFFECTIVE_DATE)
                       FROM DWHOUSE.HUB_XREF_RULE_V_D3 F
                      WHERE F.XREF_ID = R.XREF_ID
                        AND INPUT(F.EFFECTIVE_DATE, yymmdd10.) &amp;lt;= TODAY())));
QUIT;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_1-1631216361601.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63490iA70A8480F861C692/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_1-1631216361601.png" alt="xliu1_1-1631216361601.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_0-1631216319870.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63489iC9E47DE8B1F83725/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_0-1631216319870.png" alt="xliu1_0-1631216319870.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_2-1631216453004.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63491i33689526067B6932/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_2-1631216453004.png" alt="xliu1_2-1631216453004.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Sep 2021 19:41:49 GMT</pubDate>
    <dc:creator>xliu1</dc:creator>
    <dc:date>2021-09-09T19:41:49Z</dc:date>
    <item>
      <title>Expression using IN has components that are of different data types</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766966#M80997</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I keep getting error messages on the IN condition in my sas code, cannot figure out what went wrong. Any feedback would be appreciated!&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE GR_SCH AS
SELECT SUM(C.STU_SECTN_CRED) AS SCH
FROM SID.SID_COURSES_TAKEN C
WHERE C.TERMID IN ('202005', '202008', '202101') AND C.BENCH='E' AND C.CRS_NBR &amp;gt; '4999'
      AND (C.CIP_CRS NOT IN ('511201', '513818', '512308', '512001') OR 
           C.OASIS_PIDM IN 
              (SELECT NEW_VAL
               FROM DWHOUSE.HUB_XREF_RULE_V_D3 R
               WHERE R.SOURCE_NAME = 'HUB' AND R.KEY_WORD = 'IPEDS'
                AND R.QUALIFIER = '12M_EX_IN' AND R.IN_VAL1 = '20202021'
                AND R.IN_VAL2 = '1USF' AND R.EFFECTIVE_STATUS = 'A'
                AND R.EFFECTIVE_DATE =
                    (SELECT MAX(F.EFFECTIVE_DATE)
                       FROM DWHOUSE.HUB_XREF_RULE_V_D3 F
                      WHERE F.XREF_ID = R.XREF_ID
                        AND INPUT(F.EFFECTIVE_DATE, yymmdd10.) &amp;lt;= TODAY())));
QUIT;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_1-1631216361601.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63490iA70A8480F861C692/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_1-1631216361601.png" alt="xliu1_1-1631216361601.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_0-1631216319870.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63489iC9E47DE8B1F83725/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_0-1631216319870.png" alt="xliu1_0-1631216319870.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_2-1631216453004.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/63491i33689526067B6932/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_2-1631216453004.png" alt="xliu1_2-1631216453004.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 19:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766966#M80997</guid>
      <dc:creator>xliu1</dc:creator>
      <dc:date>2021-09-09T19:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using IN has components that are of different data types</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766969#M80998</link>
      <description>&lt;P&gt;What is the type of new_val?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 19:55:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766969#M80998</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-09-09T19:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using IN has components that are of different data types</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766970#M80999</link>
      <description>&lt;P&gt;IN operator requires that variables on both sides of the operator be of the same type, either numeric or character type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check is c.termid is char type? and is c.cip_crs char type and is c.oasis_pidn is the same type as new_val from dwhouse.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For any numeric variable on the left side remove the quotes on the right side from values checked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If new val is of different type than oasis_pidn then use input() function with the char type variable to make it numeric comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 20:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766970#M80999</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-09-09T20:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Expression using IN has components that are of different data types</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766972#M81000</link>
      <description>&lt;P&gt;Thanks everyone for quick response! I did not pay attention that OASIS_PIDM is a numeric type while new_val is a char type. I used input function to change new_val to numeric type, the code works out.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 20:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Expression-using-IN-has-components-that-are-of-different-data/m-p/766972#M81000</guid>
      <dc:creator>xliu1</dc:creator>
      <dc:date>2021-09-09T20:19:22Z</dc:date>
    </item>
  </channel>
</rss>

