<?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 passed ksh file parameter to sas program in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830899#M41330</link>
    <description>Thank you for the information.  it works well.  But I have another issue.  When I am calling the khs file at first, the call could be like that.&lt;BR /&gt;&lt;BR /&gt;/.../test.ksh 20220809 8&lt;BR /&gt;or&lt;BR /&gt;/.../test.ksh 20220829 &lt;BR /&gt;or&lt;BR /&gt;/.../test.ksh 8&lt;BR /&gt;&lt;BR /&gt;Also please note that I a am using a scan function to read each part of the sysparm.&lt;BR /&gt;&lt;BR /&gt;So, in the first call, the orderdate and the environment variables are provided and are read.&lt;BR /&gt;in the second call, the orderdate is provided but not the environment value.  Despite that, the scan function read properly the orderdate and the enviroment variable is empty is fine.&lt;BR /&gt;&lt;BR /&gt;But I have an issue when the orderdate is blank.  It attribute the environment value to the orderdate variable so orderdate=8 and env= is blank and what i want is orderdate blank and env=8.&lt;BR /&gt;&lt;BR /&gt;Is there a way to overcome this issue with the scan function and if so, please provide an example.</description>
    <pubDate>Mon, 29 Aug 2022 14:39:01 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2022-08-29T14:39:01Z</dc:date>
    <item>
      <title>How to passed ksh file parameter to sas program</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830600#M41315</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the following code into a ksh file.&amp;nbsp; I am able to get the first parameter but not the second.&lt;/P&gt;
&lt;P&gt;Does someone know how to do it&amp;nbsp; (see my sas code below).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#!/bin/ksh&lt;/P&gt;
&lt;P&gt;orderdate=$1&lt;BR /&gt;env=$2&lt;/P&gt;
&lt;P&gt;echo "This is environment variable read / imported in test2.ksh" $env &lt;BR /&gt;echo "This is orderdate variable read / imported in test2.ksh" $orderdate&lt;/P&gt;
&lt;P&gt;nohup sas -sysparm $orderdate $env /folder_1881/test3.sas &amp;amp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/*SAS program: test.sas*/


%put =========&amp;gt; &amp;amp;SYSPARM;

%let orderdate = %scan(&amp;amp;sysparm,1);
%let env = %scan(&amp;amp;sysparm,2);


%put &amp;amp;=orderdate;
%put &amp;amp;=env;


&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2022 14:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830600#M41315</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2022-08-26T14:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to passed ksh file parameter to sas program</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830630#M41317</link>
      <description>&lt;P&gt;Try some quotes.&amp;nbsp; You might also try SYSGET(orderdate); but I'm not sure if the shell variables are available when SAS runs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;nohup sas -sysparm "$orderdate $env" /folder_1881/test3.sas &amp;amp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2022 16:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830630#M41317</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-08-26T16:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to passed ksh file parameter to sas program</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830899#M41330</link>
      <description>Thank you for the information.  it works well.  But I have another issue.  When I am calling the khs file at first, the call could be like that.&lt;BR /&gt;&lt;BR /&gt;/.../test.ksh 20220809 8&lt;BR /&gt;or&lt;BR /&gt;/.../test.ksh 20220829 &lt;BR /&gt;or&lt;BR /&gt;/.../test.ksh 8&lt;BR /&gt;&lt;BR /&gt;Also please note that I a am using a scan function to read each part of the sysparm.&lt;BR /&gt;&lt;BR /&gt;So, in the first call, the orderdate and the environment variables are provided and are read.&lt;BR /&gt;in the second call, the orderdate is provided but not the environment value.  Despite that, the scan function read properly the orderdate and the enviroment variable is empty is fine.&lt;BR /&gt;&lt;BR /&gt;But I have an issue when the orderdate is blank.  It attribute the environment value to the orderdate variable so orderdate=8 and env= is blank and what i want is orderdate blank and env=8.&lt;BR /&gt;&lt;BR /&gt;Is there a way to overcome this issue with the scan function and if so, please provide an example.</description>
      <pubDate>Mon, 29 Aug 2022 14:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830899#M41330</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2022-08-29T14:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to passed ksh file parameter to sas program</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830906#M41331</link>
      <description>&lt;P&gt;Read about how to handle multiple parameters in shell scripts.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://unix.stackexchange.com/questions/41571/what-is-the-difference-between-and" target="_blank"&gt;https://unix.stackexchange.com/questions/41571/what-is-the-difference-between-and&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are not limited to using -sysparm command line option as the method to pass in values.&amp;nbsp; You can also use the -set command line option to define any number of environment variables which you can retrieve with the SYSGET() or %SYSGET() functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/hostunx/p1owmlnzeyxplqn14xlqeqclskd9.htm#p18kznj8pl5b3on1l8v1hoe9bgqx" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/hostunx/p1owmlnzeyxplqn14xlqeqclskd9.htm#p18kznj8pl5b3on1l8v1hoe9bgqx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n106qouqj0hfk5n1wgqpw8iovxy2.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/n106qouqj0hfk5n1wgqpw8iovxy2.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&amp;nbsp; Say your Unix shell script called SAS in this way.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;# myfile.ksh
sas -set alloptions "$*" -set option1 "$1" -set option2 "$2" myfile.sas
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then the SAS program could retrieve those three values like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* myfile.sas ;
%let alloptions=%sysget(alloption);
%let option1=%sysget(option1);
%let option2=%sysget(option2);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if you called the Unix script like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;./myfile.ksh A B C D &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro variables will be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ALLOPTIONS=A B C D
OPTION1=A
OPTION2=B&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2022 15:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-passed-ksh-file-parameter-to-sas-program/m-p/830906#M41331</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-29T15:34:24Z</dc:date>
    </item>
  </channel>
</rss>

