<?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 Same prefix with 100 varibles need to apply condition statement with single variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482708#M125082</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a a1 a2 a3;
cards;
1 2 3 4
1 2 3 1
1 1 2 1
1 2 3 1
run;


data want;
set have ;
if a=1 or a1=1 or a2 =1 or a3=1 then a4=1;
run;


I have variables with same prefix  "a" 100 variables so i'm writing code like above one but i don't need to write 100 variables names i'm using a:=1 but it not working any suggestions&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 Jul 2018 06:19:21 GMT</pubDate>
    <dc:creator>rajeshalwayswel</dc:creator>
    <dc:date>2018-07-31T06:19:21Z</dc:date>
    <item>
      <title>Same prefix with 100 varibles need to apply condition statement with single variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482708#M125082</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a a1 a2 a3;
cards;
1 2 3 4
1 2 3 1
1 1 2 1
1 2 3 1
run;


data want;
set have ;
if a=1 or a1=1 or a2 =1 or a3=1 then a4=1;
run;


I have variables with same prefix  "a" 100 variables so i'm writing code like above one but i don't need to write 100 variables names i'm using a:=1 but it not working any suggestions&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 06:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482708#M125082</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-07-31T06:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Same prefix with 100 varibles need to apply condition statement with single variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482711#M125083</link>
      <description>&lt;P&gt;Do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a a1 a2 a3;
cards;
1 2 3 4
1 2 3 1
1 1 2 1
1 2 3 1
run;

data want;
   set have;
   array MyArray{*} a:;
   if whichn(1, of MyArray[*]) ne 0 then a4=1;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 06:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482711#M125083</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-31T06:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Same prefix with 100 varibles need to apply condition statement with single variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482713#M125084</link>
      <description>If suppose if mentioned variables are characters(I mean character variable) in place of whichn function which we can use ?</description>
      <pubDate>Tue, 31 Jul 2018 06:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482713#M125084</guid>
      <dc:creator>rajeshalwayswel</dc:creator>
      <dc:date>2018-07-31T06:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Same prefix with 100 varibles need to apply condition statement with single variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482722#M125091</link>
      <description>&lt;P&gt;First, its not a great idea to have lots of variables, normalise them into rows and you will find programming a lot easier.&lt;/P&gt;
&lt;P&gt;As for character, concatenate, then find:&lt;/P&gt;
&lt;PRE&gt;if index(catx(',',of a:),"1") then a4=1;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 08:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482722#M125091</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-07-31T08:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Same prefix with 100 varibles need to apply condition statement with single variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482747#M125104</link>
      <description>&lt;P&gt;You can use the WHICHC function instead like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input a $ a1 $ a2 $ a3 $;
cards;
1 2 3 4
1 2 3 1
1 1 2 1
1 2 3 1
2 2 2 2
run;

data want;
   set have;
   if whichc("1", of a:) ne 0 then a4="1";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 09:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Same-prefix-with-100-varibles-need-to-apply-condition-statement/m-p/482747#M125104</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-31T09:54:42Z</dc:date>
    </item>
  </channel>
</rss>

