<?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 WHERE IN (number - another number) in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617174#M19028</link>
    <description>&lt;P&gt;I'm looking for a way to add number ranges in the where statement instead of adding them individually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the below would be ideal but that doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;EM&gt;&lt;CODE class=" language-sas"&gt;data mydataset;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp;mydata;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&amp;nbsp;var&amp;nbsp;IN(1-20,&amp;nbsp;30-33,&amp;nbsp;50-65);&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;I have quite many ranges, I could work around it with defining the ranges individually but I am hoping there is a more efficient way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2020 12:29:36 GMT</pubDate>
    <dc:creator>Jens89</dc:creator>
    <dc:date>2020-01-14T12:29:36Z</dc:date>
    <item>
      <title>WHERE IN (number - another number)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617174#M19028</link>
      <description>&lt;P&gt;I'm looking for a way to add number ranges in the where statement instead of adding them individually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the below would be ideal but that doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;EM&gt;&lt;CODE class=" language-sas"&gt;data mydataset;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set&amp;nbsp;mydata;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&amp;nbsp;var&amp;nbsp;IN(1-20,&amp;nbsp;30-33,&amp;nbsp;50-65);&lt;BR /&gt;quit;&lt;/CODE&gt;&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;I have quite many ranges, I could work around it with defining the ranges individually but I am hoping there is a more efficient way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 12:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617174#M19028</guid>
      <dc:creator>Jens89</dc:creator>
      <dc:date>2020-01-14T12:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE IN (number - another number)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617176#M19029</link>
      <description>&lt;P&gt;Remember, a data step end with a Run;. Not Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
var=20; output;
var=21; output;
run;

data mydataset; 
    set mydata; 
    where var in (1:20, 30:33, 50:65);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jan 2020 12:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617176#M19029</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-01-14T12:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE IN (number - another number)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617180#M19032</link>
      <description>&lt;P&gt;run indeed, I've been using too much proc sql I'd say!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if I understand the code you've written. if I have var = 20 in the first datastep, how can I then use 1:20 in the second part and why would you write var = 21 in the first step, I don't see how that fits in?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 12:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617180#M19032</guid>
      <dc:creator>Jens89</dc:creator>
      <dc:date>2020-01-14T12:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE IN (number - another number)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617181#M19033</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283672"&gt;@Jens89&lt;/a&gt;,&amp;nbsp;I just created a simple data set so you can see how the code works. ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only thing you should change in your code really is - to :&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 12:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617181#M19033</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-01-14T12:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: WHERE IN (number - another number)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617190#M19034</link>
      <description>&lt;P&gt;thanks, it worked. I had some error but it was unrelated to your solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/WHERE-IN-number-another-number/m-p/617190#M19034</guid>
      <dc:creator>Jens89</dc:creator>
      <dc:date>2020-01-14T13:27:20Z</dc:date>
    </item>
  </channel>
</rss>

