<?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 IN Operator with SAS Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799629#M314453</link>
    <description>&lt;P&gt;Hello, I just wanted to be sure that I cannot use SAS variables in an IN operator in a Data Step?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's say that I have 3 SAS variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;a = 'Mazda';
b = 'Kia';
c = 'Nissan';

if MAKE in (a, b, c);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a syntax error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I can write as literals:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;if MAKE in ('Mazda', 'Kia', 'Nissan');&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I wanted to verify that using SAS variable is not possible in a DATA step.&amp;nbsp; Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 17:40:19 GMT</pubDate>
    <dc:creator>CurtisER</dc:creator>
    <dc:date>2022-03-02T17:40:19Z</dc:date>
    <item>
      <title>IN Operator with SAS Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799629#M314453</link>
      <description>&lt;P&gt;Hello, I just wanted to be sure that I cannot use SAS variables in an IN operator in a Data Step?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's say that I have 3 SAS variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;a = 'Mazda';
b = 'Kia';
c = 'Nissan';

if MAKE in (a, b, c);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get a syntax error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know I can write as literals:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;if MAKE in ('Mazda', 'Kia', 'Nissan');&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I wanted to verify that using SAS variable is not possible in a DATA step.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 17:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799629#M314453</guid>
      <dc:creator>CurtisER</dc:creator>
      <dc:date>2022-03-02T17:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: IN Operator with SAS Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799630#M314454</link>
      <description>&lt;P&gt;Two work arounds.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The IN operator works with an ARRAY reference.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array makes a b c;
if make in makes ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use the WHICHC() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if whichc(make,of a b c) ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Mar 2022 17:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799630#M314454</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-02T17:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: IN Operator with SAS Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799631#M314455</link>
      <description>&lt;P&gt;The error message does not mention that you can use a variable, so you can't use a variable.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 17:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IN-Operator-with-SAS-Variables/m-p/799631#M314455</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-02T17:44:48Z</dc:date>
    </item>
  </channel>
</rss>

