<?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: Specifying/Reading command line arguments for a SAS program in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55816#M15588</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I figured out how to use SYSPARM to read one parameter passed to a SAS program&lt;BR /&gt;
&lt;BR /&gt;
I have the following in my .bat file&lt;BR /&gt;
---------------------------------------------------------------------------------------------&lt;BR /&gt;
set program_path="C:\DAG\SAS\Tests\sampleProgWithDiffDSWk.sas"&lt;BR /&gt;
set folder_path="C:\DAG\SAS\Tests"&lt;BR /&gt;
&lt;BR /&gt;
"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -SYSPARM %folder_path% &lt;BR /&gt;
 -SYSIN %program_path% &lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------------------------------------------------&lt;BR /&gt;
Now, if I have to pass another argument to the SAS program(say parameter file_ext=".sas7bat"), do I have to concatenate with the previous parameter string and then parse in the SAS program or is there any way to pass multiple parameters?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
    <pubDate>Thu, 30 Jul 2009 19:04:10 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-07-30T19:04:10Z</dc:date>
    <item>
      <title>Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55811#M15583</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
How do we specify command line arguments to a SAS program and how to read the value of passed arguments in the SAS program.&lt;BR /&gt;
&lt;BR /&gt;
Can someone explain please.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neelam</description>
      <pubDate>Fri, 17 Jul 2009 15:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55811#M15583</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-17T15:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55812#M15584</link>
      <description>Hello Neelam.&lt;BR /&gt;
&lt;BR /&gt;
Have you checked the SYSPARM command line option?&lt;BR /&gt;
&lt;BR /&gt;
It allows you to pass a string to the SAS session through a command line option.&lt;BR /&gt;
&lt;BR /&gt;
See documentation here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a000543608.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a000543608.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Fri, 17 Jul 2009 16:47:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55812#M15584</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-07-17T16:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55813#M15585</link>
      <description>Can you explain what a "command line arguments" represents to you?  Also, the SYSPARM= invocation paramter allows you to pass a data-string to a SAS program for access when processing.  Have a look at the SAS documentation and/or the SAS support website at &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  for details about specifying and using SAS CONFIG/OPTIONS parameter SYSPARM= for your SAS application.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 17 Jul 2009 16:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55813#M15585</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-07-17T16:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55814#M15586</link>
      <description>Thanks Daniel.&lt;BR /&gt;
&lt;BR /&gt;
Will check the documentation.</description>
      <pubDate>Fri, 17 Jul 2009 17:48:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55814#M15586</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-17T17:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55815#M15587</link>
      <description>Thanks Scott. &lt;BR /&gt;
&lt;BR /&gt;
Will refer to the links.</description>
      <pubDate>Fri, 17 Jul 2009 17:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55815#M15587</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-17T17:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55816#M15588</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I figured out how to use SYSPARM to read one parameter passed to a SAS program&lt;BR /&gt;
&lt;BR /&gt;
I have the following in my .bat file&lt;BR /&gt;
---------------------------------------------------------------------------------------------&lt;BR /&gt;
set program_path="C:\DAG\SAS\Tests\sampleProgWithDiffDSWk.sas"&lt;BR /&gt;
set folder_path="C:\DAG\SAS\Tests"&lt;BR /&gt;
&lt;BR /&gt;
"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -SYSPARM %folder_path% &lt;BR /&gt;
 -SYSIN %program_path% &lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------------------------------------------------&lt;BR /&gt;
Now, if I have to pass another argument to the SAS program(say parameter file_ext=".sas7bat"), do I have to concatenate with the previous parameter string and then parse in the SAS program or is there any way to pass multiple parameters?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
      <pubDate>Thu, 30 Jul 2009 19:04:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55816#M15588</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-30T19:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55817#M15589</link>
      <description>Yes, either using &amp;amp;SYSPARM with macro language or using a DATA step and using either my_sysparm_value="&amp;amp;SYSPARM" or the function SYSPARM().  Then your SAS application program must decide how to parse and use this information.  If you intend to use the SYSPARM information as SAS code, you will want to parse &amp;amp;SYSPARM and then resolve additional (substring) SAS code using macro variables.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 30 Jul 2009 20:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55817#M15589</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-07-30T20:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55818#M15590</link>
      <description>Thanks Scott.</description>
      <pubDate>Thu, 30 Jul 2009 21:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55818#M15590</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-30T21:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55819#M15591</link>
      <description>I see you have already found your way, but I just remembered another handy feature of SAS that might help you if you need to pass some large string to a SAS program.&lt;BR /&gt;
&lt;BR /&gt;
SYSGET function will retrieve the value of any operating environment variable.&lt;BR /&gt;
&lt;BR /&gt;
Don't know, might be handy.&lt;BR /&gt;
&lt;BR /&gt;
Check the online documentation:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000245954.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000245954.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugual.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;.</description>
      <pubDate>Fri, 31 Jul 2009 07:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55819#M15591</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-07-31T07:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55820#M15592</link>
      <description>I am having some problem passing a string and parsing it in the SAS program.&lt;BR /&gt;
&lt;BR /&gt;
I have a macro given below with signature&lt;BR /&gt;
&lt;BR /&gt;
%macro findMatches (dir,pattern);&lt;BR /&gt;
&lt;BR /&gt;
I invoke it as - With (sample values as below)&lt;BR /&gt;
%let rootFolder = C:\DAG\SAS\Tests;&lt;BR /&gt;
%let fileExt = .sas7bdat;&lt;BR /&gt;
%findMatches(&amp;amp;rootFolder,&amp;amp;fileExt);&lt;BR /&gt;
&lt;BR /&gt;
This works fine.&lt;BR /&gt;
&lt;BR /&gt;
I am trying to run my SAS program through command line with the values for rootFolder and fileExt as command line arguments.&lt;BR /&gt;
&lt;BR /&gt;
I want to send it as a string with both values separated with a character which will help me parse the 2 values in the program. I chose # as the separator character. So in the bat file I invoke the program as &lt;BR /&gt;
&lt;BR /&gt;
"C:\Program Files\SAS\SASFoundation\9.2\sas.exe" -SYSPARM C:\DAG\SAS\Tests#.sas7bdat -SYSIN %program_path% -log %log_path% And I have something like below to parse and invoke the above mentioned macro&lt;BR /&gt;
&lt;BR /&gt;
index = FIND(&amp;amp;SYSPARM,'#');&lt;BR /&gt;
rootFolderTemp = SUBSTR(&amp;amp;SYSPARM,1,index-1);&lt;BR /&gt;
fileExtTemp = SUBSTR(&amp;amp;SYSPARM,index+1);&lt;BR /&gt;
&lt;BR /&gt;
%let rootFolder = rootFolderTemp;&lt;BR /&gt;
%let fileExt = fileExtTemp;&lt;BR /&gt;
%findMatches(&amp;amp;rootFolder,&amp;amp;fileExt);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I get the following error messages in the log file &lt;BR /&gt;
&lt;BR /&gt;
-----------------------------------------------------------------------&lt;BR /&gt;
    &lt;BR /&gt;
123        index = FIND(&amp;amp;SYSPARM,'#');&lt;BR /&gt;
NOTE: Line generated by the macro variable "SYSPARM".&lt;BR /&gt;
123        C:\DAG\SAS\Tests#.sas7bdat&lt;BR /&gt;
            _&lt;BR /&gt;
            388&lt;BR /&gt;
            76&lt;BR /&gt;
ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
124        rootFolderTemp = SUBSTR(&amp;amp;SYSPARM,1,index-1);&lt;BR /&gt;
NOTE: Line generated by the macro variable "SYSPARM".&lt;BR /&gt;
124        C:\DAG\SAS\Tests#.sas7bdat&lt;BR /&gt;
            _&lt;BR /&gt;
            388&lt;BR /&gt;
            76&lt;BR /&gt;
ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
125        fileExtTemp = SUBSTR(&amp;amp;SYSPARM,index+1);&lt;BR /&gt;
NOTE: Line generated by the macro variable "SYSPARM".&lt;BR /&gt;
125        C:\DAG\SAS\Tests#.sas7bdat&lt;BR /&gt;
            _&lt;BR /&gt;
            388&lt;BR /&gt;
            76&lt;BR /&gt;
ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
Any ideas how to resolve this?&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Neel</description>
      <pubDate>Mon, 03 Aug 2009 21:23:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55820#M15592</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-03T21:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Specifying/Reading command line arguments for a SAS program</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55821#M15593</link>
      <description>Your use of &amp;amp;SYSPARM in DATA step code, as you have shared, requires the string be enclosed in double quotations so it is treated as a constant rather than an illegal-named SAS variable.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Mon, 03 Aug 2009 21:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Specifying-Reading-command-line-arguments-for-a-SAS-program/m-p/55821#M15593</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-03T21:46:42Z</dc:date>
    </item>
  </channel>
</rss>

