<?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: Simple where statement problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255424#M48771</link>
    <description>&lt;P&gt;Please try "in" operator&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data specialty_code;
set master_data;
where specialty in (1 95);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Mar 2016 03:14:30 GMT</pubDate>
    <dc:creator>Jagadishkatam</dc:creator>
    <dc:date>2016-03-09T03:14:30Z</dc:date>
    <item>
      <title>Simple where statement problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255422#M48770</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this problem that looks sooooo simple but can't seem to figure it out, as it gives no errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this variable called 'specialty'. It consists of numeric values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract only the code 1 and 95 from my data set. I used the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data specialty_code;
set master_data;
where specialty=1 and 95;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I submit it, it runs smoothly and gives me the observation number of x. but when I do a quick quality check, it only kept the specialty code 1 and didn't keep any of the code 95. Am I using the where statement wrong? It worked when I used where-and statement for 2 different variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 02:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255422#M48770</guid>
      <dc:creator>jwill731</dc:creator>
      <dc:date>2016-03-09T02:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Simple where statement problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255424#M48771</link>
      <description>&lt;P&gt;Please try "in" operator&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data specialty_code;
set master_data;
where specialty in (1 95);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2016 03:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255424#M48771</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2016-03-09T03:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simple where statement problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255426#M48772</link>
      <description>&lt;P&gt;Where specialty in (1 95);&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 03:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255426#M48772</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-09T03:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Simple where statement problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255428#M48773</link>
      <description>&lt;P&gt;For SAS any number other than 0 or missing is equivalent to the logical value TRUE. When specialty is 1, specialty=1 evaluates to TRUE, then TRUE and 95 &amp;nbsp;is equivalent to TRUE and TRUE which evaluates to TRUE. When specialty is 95, or anything other than 1, you end up with the equivalent of FALSE and TRUE, which is FALSE. The proper syntax is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data specialty_code;
set master_data;
where specialty=1 or specialty=95;
run;

/* Or */

data specialty_code;
set master_data;
where specialty in (1, 95);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 03:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simple-where-statement-problem/m-p/255428#M48773</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-03-09T03:13:12Z</dc:date>
    </item>
  </channel>
</rss>

