<?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: How to write equivalent or alternative of  SAS macro parameter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742127#M232070</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17460"&gt;@ManoharNath&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;While agreeing with other that there is a need in clarity of what you want, I guest you want to handle a scanrio where one may call a macro without specifying one or more parameters. Have a look at the following&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro greetings(mygreet="Namaskaram", Country="India");
%put &amp;amp;=mygreet , &amp;amp;=Country;
%mend greetings;
%greetings()
%greetings(mygreet="Suprabhatam")
%greetings(mygreet="Bon Jour", Country="France")

%greetings(mygreet="Hello", Country="United States")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output will be something like as follows. If you miss to type or do not specify a value a default will be used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         %macro greetings(mygreet="Namaskaram", Country="India");
 74         %put &amp;amp;=mygreet , &amp;amp;=Country;
 75         %mend greetings;
 76         %greetings()
 MYGREET="Namaskaram" , COUNTRY="India"
 77         %greetings(mygreet="Suprabhatam")
 MYGREET="Suprabhatam" , COUNTRY="India"
 78         %greetings(mygreet="Bon Jour", Country="France")
 MYGREET="Bon Jour" , COUNTRY="France"
 79         
 80         %greetings(mygreet="Hello", Country="United States")
 MYGREET="Hello" , COUNTRY="United States"
 81         
 82         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you can see the&lt;/P&gt;
&lt;P&gt;(i) in the first macro call no parameter was specified. The defaults were taken&lt;/P&gt;
&lt;P&gt;(ii) In the second call&amp;nbsp; the value of second parameter country was not specified , so the default values was taken for the missing.&lt;/P&gt;
&lt;P&gt;(iii) In other macro calls ,&amp;nbsp; parameters were specified and they were taken.&lt;BR /&gt;If this does not answer your question please clarify what you need.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 May 2021 13:09:51 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2021-05-18T13:09:51Z</dc:date>
    <item>
      <title>How to write equivalent or alternative of  SAS macro parameter without using any macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742098#M232054</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am working on to replicate this SAS code in another way in SAS means in data step or proc sql without using any macro,&amp;nbsp; please help me. What I am doing here is that, I've&amp;nbsp; created two metrics or measures which have metric value and metric base value to reflect in my reports.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This codes is working but I am looking for another way and need to know can I do this in another way or not.&lt;/P&gt;
&lt;P&gt;below is the output how it will look like, I want below output via without using macro means data step or proc sql.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ManoharNathGupta_0-1621352064716.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/59563iA1FB9E0A2E425094/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ManoharNathGupta_0-1621352064716.png" alt="ManoharNathGupta_0-1621352064716.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test_macro(sex, metnam, measuresuf, measurebase, bas_flag);&lt;BR /&gt;proc sql;&lt;BR /&gt;create table tan_1 as&lt;BR /&gt;select sex,&amp;amp;metnam as metric_name, sum(&amp;amp;measuresuf) as metric_value,&lt;BR /&gt;sum(&amp;amp;measurebase) as metric_base,&lt;BR /&gt;&amp;amp;bas_flag as bas_calc_flag,&lt;BR /&gt;'ABC' as legal_entity&lt;BR /&gt;from sashelp.class&lt;BR /&gt;group by 1&lt;BR /&gt;order by 1&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;%mend;&lt;BR /&gt;%test_macro('M','age_male',Height ,Weight, 1);&lt;BR /&gt;%test_macro('F','age_Feml',Height ,Weight, 1);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data tan_2;&lt;BR /&gt;set tan_1;&lt;BR /&gt;run;&lt;BR /&gt;proc print data = tan_2;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 15:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742098#M232054</guid>
      <dc:creator>ManoharNath</dc:creator>
      <dc:date>2021-05-18T15:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742099#M232055</link>
      <description>&lt;P&gt;Please explain what this macro does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain why you want to do it a different way. Does it not work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the future, it would be very helpful to us if you indented your code properly, this would help us decipher your code.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 10:42:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742099#M232055</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-18T10:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742114#M232066</link>
      <description>&lt;P&gt;Please also include sample data and example of what you want your results to look like.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 12:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742114#M232066</guid>
      <dc:creator>CarmineVerrell</dc:creator>
      <dc:date>2021-05-18T12:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742127#M232070</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17460"&gt;@ManoharNath&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;While agreeing with other that there is a need in clarity of what you want, I guest you want to handle a scanrio where one may call a macro without specifying one or more parameters. Have a look at the following&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro greetings(mygreet="Namaskaram", Country="India");
%put &amp;amp;=mygreet , &amp;amp;=Country;
%mend greetings;
%greetings()
%greetings(mygreet="Suprabhatam")
%greetings(mygreet="Bon Jour", Country="France")

%greetings(mygreet="Hello", Country="United States")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output will be something like as follows. If you miss to type or do not specify a value a default will be used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         %macro greetings(mygreet="Namaskaram", Country="India");
 74         %put &amp;amp;=mygreet , &amp;amp;=Country;
 75         %mend greetings;
 76         %greetings()
 MYGREET="Namaskaram" , COUNTRY="India"
 77         %greetings(mygreet="Suprabhatam")
 MYGREET="Suprabhatam" , COUNTRY="India"
 78         %greetings(mygreet="Bon Jour", Country="France")
 MYGREET="Bon Jour" , COUNTRY="France"
 79         
 80         %greetings(mygreet="Hello", Country="United States")
 MYGREET="Hello" , COUNTRY="United States"
 81         
 82         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As you can see the&lt;/P&gt;
&lt;P&gt;(i) in the first macro call no parameter was specified. The defaults were taken&lt;/P&gt;
&lt;P&gt;(ii) In the second call&amp;nbsp; the value of second parameter country was not specified , so the default values was taken for the missing.&lt;/P&gt;
&lt;P&gt;(iii) In other macro calls ,&amp;nbsp; parameters were specified and they were taken.&lt;BR /&gt;If this does not answer your question please clarify what you need.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 13:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742127#M232070</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-18T13:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742214#M232106</link>
      <description>&lt;P&gt;just used and added sashelp.class table,&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 15:40:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742214#M232106</guid>
      <dc:creator>ManoharNath</dc:creator>
      <dc:date>2021-05-18T15:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742216#M232108</link>
      <description>&lt;P&gt;Thank you, but I need the output without using any macro, I have just mentioned code and shown what output is required.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 15:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742216#M232108</guid>
      <dc:creator>ManoharNath</dc:creator>
      <dc:date>2021-05-18T15:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742221#M232113</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17460"&gt;@ManoharNath&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;In my opinion using macros is the right approach for this type of issues&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 15:58:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742221#M232113</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-05-18T15:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742235#M232127</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17460"&gt;@ManoharNath&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, but I need the output without using any macro, I have just mentioned code and shown what output is required.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'm not sure I agree completely with this statement.&lt;/P&gt;
&lt;P&gt;However your current code is likely not working because the second macro call overwrites the data set Tan_1 each time it is called, so you only get the results from the last call.&lt;/P&gt;
&lt;P&gt;Add a parameter to name the output data set of Proc Sql and instead of&lt;/P&gt;
&lt;PRE&gt;data tan_2;
set tan_1;
run;&lt;/PRE&gt;
&lt;P&gt;list all the names instead just tan_1.&lt;/P&gt;
&lt;P&gt;Hint: If you use a macro parameter to create sets with a common unique prefix you can reference them in the set statement&amp;nbsp; as:&amp;nbsp; Set prefix: ; the : list creator will use all the data sets whose names start with the given prefix text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 16:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/742235#M232127</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-18T16:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/749871#M235744</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17460" target="_blank"&gt;@ManoharNathGupta&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not want to judge why you do not want to use macros. There are may reasons to do, but maybe some not to. In that case, see a SAS macro as a text with "slots". Also, see a macro call as a trigger to start this macro. You have two calls, so you trigger the same "text" two times.&lt;/P&gt;&lt;P&gt;So, copy the "text" two times.&lt;/P&gt;&lt;P&gt;Replace the so-called macro variables beginning with &amp;amp; with the values from the first macro call in the first text&lt;/P&gt;&lt;P&gt;Replace the so-called macro variables beginning with &amp;amp; with the values from the second macro call in the second text&lt;/P&gt;&lt;P&gt;That should be it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 14:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/749871#M235744</guid>
      <dc:creator>KidCat</dc:creator>
      <dc:date>2021-06-23T14:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to write equivalent or alternative of  SAS macro parameter without using any macro.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/749918#M235771</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17460"&gt;@ManoharNath&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;From your question what I see is that&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;I am working on to replicate this SAS code in another way in &lt;STRONG&gt;SAS means in data step or proc sql without using any macro&lt;/STRONG&gt;, "&lt;BR /&gt;&lt;/SPAN&gt;Later your requirement is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"This codes is working but I am looking for another way and need to know can I do this in another way or not.&lt;/P&gt;
&lt;P&gt;below is the output how it will look like, I want below output via &lt;STRONG&gt;without using macro means data step or proc sql&lt;/STRONG&gt;."&lt;/P&gt;
&lt;P&gt;Can you please clarify if you want to avoid use of macros &lt;STRONG&gt;OR&lt;/STRONG&gt; (Proc Means and Proc SQL) &lt;STRONG&gt;OR&lt;/STRONG&gt; Both?&lt;/P&gt;
&lt;P&gt;It you let us know why don't want to use macros' we can be on the same page and perhaps answer your question appropriately.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Jun 2021 16:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-write-equivalent-or-alternative-of-SAS-macro-parameter/m-p/749918#M235771</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-06-23T16:56:23Z</dc:date>
    </item>
  </channel>
</rss>

