<?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: Call a sas program with run time parameters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392143#M94309</link>
    <description>&lt;P&gt;There's a corresponding SYSPARM() function&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#n1ug7uhp2d4vpmn149431l4pcucf.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#n1ug7uhp2d4vpmn149431l4pcucf.htm&lt;/A&gt; which will retrieve the parameters in one string which you can then split up with the SCAN() function.&lt;/P&gt;</description>
    <pubDate>Thu, 31 Aug 2017 10:55:59 GMT</pubDate>
    <dc:creator>ChrisBrooks</dc:creator>
    <dc:date>2017-08-31T10:55:59Z</dc:date>
    <item>
      <title>Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392125#M94297</link>
      <description>&lt;P&gt;I have a sas program named test.sas having a macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro mymacro(input1=, input2=, input3=);
/*
piece of code.

*/
%mymacro(input1=a, input2=b, input3=c)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I want to supply these macro input parameters as runtime parameters on unix server.&lt;/P&gt;
&lt;P&gt;something like :&lt;/P&gt;
&lt;P&gt;sas test.sas parameter1 parameter2 parameter3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How will I call this program by passing input and get these inputs in my macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please suggest a way.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 08:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392125#M94297</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-08-31T08:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392127#M94299</link>
      <description>&lt;P&gt;You need to wrap your macro in a .sas file and use the -SYSPARM option to pass the parameters&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n0u0t8c3b3syeen1l1rqh60ekmfz.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostwin/69955/HTML/default/viewer.htm#n0u0t8c3b3syeen1l1rqh60ekmfz.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 09:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392127#M94299</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-08-31T09:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392138#M94306</link>
      <description>ok.. How will I retrieve the parameters in macro &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32246"&gt;@ChrisBrooks&lt;/a&gt;</description>
      <pubDate>Thu, 31 Aug 2017 10:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392138#M94306</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-08-31T10:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392141#M94308</link>
      <description>&lt;P&gt;Use a shell script that sets environment variables before running the program:&lt;/P&gt;
&lt;PRE&gt;export PARAM1=xxx
export PARAM2=yyyy
export PARAM3=zzz
sas test.sas&lt;/PRE&gt;
&lt;P&gt;And then retrieve the environment variables in your SAS code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let param1=%sysget(PARAM1);
%let param2=%sysget(PARAM2);
%let param3=%sysget(PARAM3);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 10:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392141#M94308</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-31T10:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392143#M94309</link>
      <description>&lt;P&gt;There's a corresponding SYSPARM() function&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#n1ug7uhp2d4vpmn149431l4pcucf.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#n1ug7uhp2d4vpmn149431l4pcucf.htm&lt;/A&gt; which will retrieve the parameters in one string which you can then split up with the SCAN() function.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 10:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392143#M94309</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-08-31T10:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392152#M94314</link>
      <description>Hi Kurt,&lt;BR /&gt;&lt;BR /&gt;Can I get parameters in macro call:&lt;BR /&gt;%test(&lt;BR /&gt;a= %sysget(PARAM1) &lt;BR /&gt;,b= %sysget(PARAM2) 		&lt;BR /&gt;,c= %sysget(PARAM3)  				&lt;BR /&gt;,d= %sysget(PARAM4)  &lt;BR /&gt;,e= %sysget(PARAM5) 			&lt;BR /&gt;);</description>
      <pubDate>Thu, 31 Aug 2017 11:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392152#M94314</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-08-31T11:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392158#M94317</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56669"&gt;@Arjumand&lt;/a&gt; wrote:&lt;BR /&gt;Hi Kurt,&lt;BR /&gt;&lt;BR /&gt;Can I get parameters in macro call:&lt;BR /&gt;%test(&lt;BR /&gt;a= %sysget(PARAM1) &lt;BR /&gt;,b= %sysget(PARAM2) &lt;BR /&gt;,c= %sysget(PARAM3) &lt;BR /&gt;,d= %sysget(PARAM4) &lt;BR /&gt;,e= %sysget(PARAM5) &lt;BR /&gt;);&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Of course you can!&lt;/P&gt;
&lt;P&gt;Based on your example (please use a code posting window - {i} or "little running man" in the future for posting code, to preserve formatting) I wrote a short program and saved it as envtest.sas:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(a=,b=,c=,d=,e=);
%put a=&amp;amp;a;
%put b=&amp;amp;b;
%put c=&amp;amp;c;
%put d=&amp;amp;d;
%put e=&amp;amp;e;
%mend;

%test(
a= %sysget(PARAM1)
,b= %sysget(PARAM2)
,c= %sysget(PARAM3)
,d= %sysget(PARAM4)
,e= %sysget(PARAM5)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then I wrote this shell script:&lt;/P&gt;
&lt;PRE&gt;export PARAM1=xxx
export PARAM2=yyy
export PARAM3=zzz
export PARAM4=111
export PARAM5=222
sas envtest.sas&lt;/PRE&gt;
&lt;P&gt;After running the shell script, this is the log:&lt;/P&gt;
&lt;PRE&gt;1          %macro test(a=,b=,c=,d=,e=);
2          %put a=&amp;amp;a;
3          %put b=&amp;amp;b;
4          %put c=&amp;amp;c;
5          %put d=&amp;amp;d;
6          %put e=&amp;amp;e;
7          %mend;
8
9          %test(
10         a= %sysget(PARAM1)
11         ,b= %sysget(PARAM2)
12         ,c= %sysget(PARAM3)
13         ,d= %sysget(PARAM4)
14         ,e= %sysget(PARAM5)
15         );
a=xxx
b=yyy
c=zzz
d=111
e=222
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: Das SAS System used:
      real time           0.28 seconds
      cpu time            0.02 seconds&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 11:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392158#M94317</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-31T11:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392164#M94323</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;: Just one last question, how can we call the same program from command promt in windows?&lt;BR /&gt;Thanks so much for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 31 Aug 2017 12:18:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392164#M94323</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-08-31T12:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392170#M94327</link>
      <description>&lt;P&gt;To set environment variables in Windows from the commandline, use the &lt;FONT face="courier new,courier"&gt;set&lt;/FONT&gt; command.&lt;/P&gt;
&lt;P&gt;My method would be to write a simple .bat file that looks quite similar to the UNIX shell script, with set instead of export.&lt;/P&gt;
&lt;P&gt;Others may prefer to use VBS, as that is more "modern".&lt;/P&gt;
&lt;P&gt;Since I don't run SAS on Windows, the question does not arise for me. I have a real operating system at hand.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 12:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392170#M94327</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-31T12:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392174#M94331</link>
      <description>&lt;P&gt;Yes. You can do it .@Rick_SAS has written a blog about it before. Check out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 12:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392174#M94331</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-31T12:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392179#M94334</link>
      <description>Thanks a lot everyone.</description>
      <pubDate>Thu, 31 Aug 2017 13:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392179#M94334</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-08-31T13:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392545#M94485</link>
      <description>Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I am running as per you suggested and the program seems to be executing, but the parameters are not read using the command in this blog. Plus I am getting "-set is not recognized as an internal or external command" error in console. Please suggest.</description>
      <pubDate>Fri, 01 Sep 2017 14:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392545#M94485</guid>
      <dc:creator>Arjumand</dc:creator>
      <dc:date>2017-09-01T14:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392646#M94520</link>
      <description>&lt;P&gt;see my paper &lt;A title="Sysparm Companion" href="http://www.mwsug.org/proceedings/2016/TT/MWSUG-2016-TT04.pdf" target="_self"&gt;Sysparm Companion&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code is on this page: &lt;A href="http://www.sascommunity.org/wiki/Parse_sysparm" target="_self"&gt;sco Parse sysparm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; command-line options maven&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 19:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392646#M94520</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2017-09-01T19:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Call a sas program with run time parameters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392726#M94536</link>
      <description>&lt;P&gt;Your sas is under UNIX/LINUX/AIX OS? If it was,then Kurt's answer is right for you. otherwise, I don' know what is going on with it.&lt;/P&gt;
&lt;P&gt;calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Sep 2017 11:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-a-sas-program-with-run-time-parameters/m-p/392726#M94536</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-09-02T11:04:17Z</dc:date>
    </item>
  </channel>
</rss>

