<?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 How to use Macro to make a new variables according to known variables. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808724#M318895</link>
    <description>&lt;P&gt;If the data like the following,&amp;nbsp;&lt;/P&gt;&lt;P&gt;a=1, 2, 3, 4&amp;nbsp; &amp;nbsp;b=1, 2, 3, 4&amp;nbsp; &amp;nbsp;c=1, 2, 3, 4.&lt;/P&gt;&lt;P&gt;if a=1 or b=1 or c=1 then d1=1; else d1=0;&lt;/P&gt;&lt;P&gt;if a=2 or b=2 or c=2 then d2=1; else d2=0;&lt;/P&gt;&lt;P&gt;if a=3 or b=3 or c=3 then d3=1; else d3=0;&lt;/P&gt;&lt;P&gt;if a=4 or b=4 or c=4 then d4=1; else d4=0;&lt;/P&gt;&lt;P&gt;So how to make the programs easier by Macro.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 04:08:55 GMT</pubDate>
    <dc:creator>Christina_fan</dc:creator>
    <dc:date>2022-04-20T04:08:55Z</dc:date>
    <item>
      <title>How to use Macro to make a new variables according to known variables.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808724#M318895</link>
      <description>&lt;P&gt;If the data like the following,&amp;nbsp;&lt;/P&gt;&lt;P&gt;a=1, 2, 3, 4&amp;nbsp; &amp;nbsp;b=1, 2, 3, 4&amp;nbsp; &amp;nbsp;c=1, 2, 3, 4.&lt;/P&gt;&lt;P&gt;if a=1 or b=1 or c=1 then d1=1; else d1=0;&lt;/P&gt;&lt;P&gt;if a=2 or b=2 or c=2 then d2=1; else d2=0;&lt;/P&gt;&lt;P&gt;if a=3 or b=3 or c=3 then d3=1; else d3=0;&lt;/P&gt;&lt;P&gt;if a=4 or b=4 or c=4 then d4=1; else d4=0;&lt;/P&gt;&lt;P&gt;So how to make the programs easier by Macro.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 04:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808724#M318895</guid>
      <dc:creator>Christina_fan</dc:creator>
      <dc:date>2022-04-20T04:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Macro to make a new variables according to known variables.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808728#M318896</link>
      <description>&lt;P&gt;No macro needed, use arrays and a DO loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
array in {*} a b c;
array out {*} d1-d4;
do i = 1 to dim(out);
  out{i} = (whichn(i,of in{*}) &amp;gt; 0);
end;
drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 04:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808728#M318896</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-20T04:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Macro to make a new variables according to known variables.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808729#M318897</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;It works.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 04:50:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808729#M318897</guid>
      <dc:creator>Christina_fan</dc:creator>
      <dc:date>2022-04-20T04:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Macro to make a new variables according to known variables.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808815#M318922</link>
      <description>&lt;P&gt;You really only need the one macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;out{i} = (whichn(i,of a b c) &amp;gt; 0)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2022 13:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Macro-to-make-a-new-variables-according-to-known/m-p/808815#M318922</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-20T13:29:59Z</dc:date>
    </item>
  </channel>
</rss>

