<?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: duplicate macro parameters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818184#M322957</link>
    <description>&lt;P&gt;I guess I don't understand the question.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you give an example of what you expect? Can you provide a deeper explanation in words (not in SAS code)?&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jun 2022 18:30:36 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-06-14T18:30:36Z</dc:date>
    <item>
      <title>duplicate macro parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818183#M322956</link>
      <description>&lt;P&gt;There there a way for one macro parameter to refer to another?&amp;nbsp; &amp;nbsp;To use a really simplistic example, what if I had the following?&amp;nbsp; &amp;nbsp;In the second iteration, the parameters have the same value.&amp;nbsp; &amp;nbsp; Is there a way for the second parameter to refer to back to the first?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;%macro vals(a,b);&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;x=&amp;amp;a;&lt;BR /&gt;y=&amp;amp;b;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;BR /&gt;%vals(1,2)&lt;BR /&gt;%vals(1,1)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 18:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818183#M322956</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2022-06-14T18:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: duplicate macro parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818184#M322957</link>
      <description>&lt;P&gt;I guess I don't understand the question.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you give an example of what you expect? Can you provide a deeper explanation in words (not in SAS code)?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 18:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818184#M322957</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-14T18:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: duplicate macro parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818187#M322959</link>
      <description>&lt;P&gt;I'm trying to avoid listening the duplicate parameter the second time.&amp;nbsp; &amp;nbsp;It may seem like a dumb request in this case, the actual program I'm working with is a lot more complicated and I just use this one the simplicity of explanation.&amp;nbsp; &amp;nbsp;I'll give you an example that doesn't work, but it did, would solve the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;%macro vals(a,b);&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;x=&amp;amp;a;&lt;BR /&gt;y=&amp;amp;b;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;BR /&gt;%vals(1,2)&lt;BR /&gt;%vals(1,&amp;amp;a)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 18:35:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818187#M322959</guid>
      <dc:creator>Batman</dc:creator>
      <dc:date>2022-06-14T18:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: duplicate macro parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818189#M322961</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/9248"&gt;@Batman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to avoid listening the duplicate parameter the second time.&amp;nbsp; &amp;nbsp;It may seem like a dumb request in this case, the actual program I'm working with is a lot more complicated and I just use this one the simplicity of explanation.&amp;nbsp; &amp;nbsp;I'll give you an example that doesn't work, but it did, would solve the problem.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Thanks, I think I understand now. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%global a1;
%macro vals(a,b);
%let a1=&amp;amp;a;
data _null_;
x=&amp;amp;a;
y=&amp;amp;b;
run;

%mend;
%vals(1,2)
%vals(1,&amp;amp;a1)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Although, I get the very strong feeling that if you explained to bigger problem, there might be better ways to do this. Often it is very helpful to hear WHY you need this, rather than just hearing that you do need this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2022 18:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818189#M322961</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-14T18:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: duplicate macro parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818192#M322963</link>
      <description>&lt;P&gt;This seems reasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;47         %macro vals(a,b);
48            %put _local_;
49            %if %superq(b) eq %then %let b=&amp;amp;a;
50            %put _local_;
51            %mend;
52         %vals(1,2)
VALS A 1
VALS B 2
VALS A 1
VALS B 2
53         %vals(1)
VALS A 1
VALS B 
VALS A 1
VALS B 1&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jun 2022 19:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/duplicate-macro-parameters/m-p/818192#M322963</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-06-14T19:25:31Z</dc:date>
    </item>
  </channel>
</rss>

