<?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: subsetting a dataset where multiple variables equal the same number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387214#M92817</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142222"&gt;@BenBrady&lt;/a&gt;If you wanna play:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;a=&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;b=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;c=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;a=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;b=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;c=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array n _numeric_;&lt;/P&gt;&lt;P&gt;if &lt;STRONG&gt;1&lt;/STRONG&gt; in n;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 01:16:23 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2017-08-11T01:16:23Z</dc:date>
    <item>
      <title>subsetting a dataset where multiple variables equal the same number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387208#M92815</link>
      <description>&lt;P&gt;i want to subset my dataset by where multiple variables are equal to the number 1. I have been doing this by using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;where group=1 or fish-=1 or net=1 or food=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wandering if there was a shorter way to write this, as it would be much longer if there were a lot of variables. i.e something along the lines of writing all the variables out and only having to write one '=1' in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 00:32:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387208#M92815</guid>
      <dc:creator>BenBrady</dc:creator>
      <dc:date>2017-08-11T00:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: subsetting a dataset where multiple variables equal the same number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387209#M92816</link>
      <description>&lt;P&gt;WHICHN()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where whichn(1, var1, var2, var3, ... );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;If you can use IF instead variable lists can be used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if whichn(1, of var:)&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 00:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387209#M92816</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-11T00:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: subsetting a dataset where multiple variables equal the same number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387214#M92817</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142222"&gt;@BenBrady&lt;/a&gt;If you wanna play:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;a=&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;b=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;c=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;a=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;b=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;c=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array n _numeric_;&lt;/P&gt;&lt;P&gt;if &lt;STRONG&gt;1&lt;/STRONG&gt; in n;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 01:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/subsetting-a-dataset-where-multiple-variables-equal-the-same/m-p/387214#M92817</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-08-11T01:16:23Z</dc:date>
    </item>
  </channel>
</rss>

