<?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 pass a macro variable to a linux variable in a shell script in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876596#M346308</link>
    <description>&lt;P&gt;Giving it a try, will update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 02:56:15 GMT</pubDate>
    <dc:creator>naks02</dc:creator>
    <dc:date>2023-05-19T02:56:15Z</dc:date>
    <item>
      <title>How to pass a macro variable to a linux variable in a shell script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876362#M346253</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have written a linux shell script for SAS users, when executed on the server it prompts the user for example, userID, appID, Authdomain. Users don't have access to the server to execute the script. I would appreciate assistance on how to write a sas program that users can input mentioned variables in SASStudio and get pushed to linux variables. I don't want the values to be hard coded. My understanding this can be done using macro variables but don't know how.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bash script when executed on the server side.&lt;/P&gt;&lt;P&gt;read -r SAS_SERVICES_ENDPOINT&lt;BR /&gt;read -r userID&lt;BR /&gt;read -r AdGroup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am assuming the shell script will change to this when receiving input from sas program.&lt;/P&gt;&lt;P&gt;export SAS_SERVICES_ENDPOINT=&amp;amp;Sas_end_point&lt;BR /&gt;export ADGROUP=&amp;amp;AdGroup&lt;BR /&gt;export FID=&amp;amp;userID&lt;BR /&gt;export APPID=&amp;amp;AppID&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 04:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876362#M346253</guid>
      <dc:creator>naks02</dc:creator>
      <dc:date>2023-05-18T04:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a macro variable to a linux variable in a shell script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876416#M346255</link>
      <description>&lt;P&gt;Will this script be executed from the SAS Studio level (in the current user SAS Studio sas session )?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 11:34:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876416#M346255</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-05-18T11:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a macro variable to a linux variable in a shell script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876433#M346259</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes it will&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 12:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876433#M346259</guid>
      <dc:creator>naks02</dc:creator>
      <dc:date>2023-05-18T12:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a macro variable to a linux variable in a shell script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876463#M346264</link>
      <description>&lt;P&gt;so how about creating a macro calling X inside:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro runBashScript(Sas_end_point,AdGroup);
x "export SAS_SERVICES_ENDPOINT=&amp;amp;Sas_end_point";
x "export ADGROUP=&amp;amp;AdGroup";
/*
...
*/
x "/path/to/the/script/theScript.sh";
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and for user it would be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%runBashScript(
https://enpoint.com/
,supergroup
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 14:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876463#M346264</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-05-18T14:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a macro variable to a linux variable in a shell script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876596#M346308</link>
      <description>&lt;P&gt;Giving it a try, will update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 02:56:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/876596#M346308</guid>
      <dc:creator>naks02</dc:creator>
      <dc:date>2023-05-19T02:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass a macro variable to a linux variable in a shell script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/877776#M346763</link>
      <description>&lt;P&gt;I thought I had sent this, apologize for the the delay. The macro variables are not being passed to the shell script. Thoughts?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;shell script variable set to&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;export SAS_SERVICES_ENDPOINT=$sas_end_point&lt;BR /&gt;export AUTHDOMAIN=$Authdomain&lt;BR /&gt;export ADGROUP=$AdGroup&lt;BR /&gt;export FID=$Fid&lt;BR /&gt;export APPID=$AppID&lt;BR /&gt;export PASSWORD=$Password&lt;BR /&gt;Password=$(echo -n "Password" | base64);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;log of sas program, macro variables are set as below&lt;/P&gt;&lt;P&gt;* Set values;&lt;BR /&gt;%macro authUpdate(sas_end_point,AdGroup,Fid,Authdomain,AppID,Password);&lt;BR /&gt;x "export SAS_SERVICES_ENDPOINT=&amp;amp;sas_end_point";&lt;BR /&gt;x "export ADGROUP=&amp;amp;AdGroup";&lt;BR /&gt;x "export FID=&amp;amp;FID";&lt;BR /&gt;x "export AUTHDOMAIN=&amp;amp;Authdomain";&lt;BR /&gt;x "export USERID=&amp;amp;UserID";&lt;BR /&gt;x "export PASSWORD=&amp;amp;Password";&lt;BR /&gt;/* ... */&lt;BR /&gt;x "/cloud/svv001/scenarios/a_sasad/amos/set-pass-viya_Copy2.sh";&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;/* User info to update authdomain */&lt;BR /&gt;%authUpdate(&lt;A href="https://sasviya-dev.apps.test.net/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://sasviya-dev.apps.test.net/&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;,AmosNewOAuth , SASVIYA_100421-88790-PROD ,b28111 ,88821-A-SASVIYA, Password);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shell script&amp;nbsp; variables after sas program is ran. Macro variables are not passed to the shell script&lt;BR /&gt;+ echo&lt;BR /&gt;&amp;gt;&lt;BR /&gt;&amp;gt; + export SAS_SERVICES_ENDPOINT=&lt;BR /&gt;&amp;gt; + SAS_SERVICES_ENDPOINT=&lt;BR /&gt;&amp;gt; + export AUTHDOMAIN=&lt;BR /&gt;&amp;gt; + AUTHDOMAIN=&lt;BR /&gt;&amp;gt; + export ADGROUP=&lt;BR /&gt;&amp;gt; + ADGROUP=&lt;BR /&gt;&amp;gt; + export FID=&lt;BR /&gt;&amp;gt; + FID=&lt;BR /&gt;&amp;gt; + export APPID=&lt;BR /&gt;&amp;gt; + APPID=&lt;BR /&gt;&amp;gt; + genToken&lt;BR /&gt;&amp;gt; ++ curl -s -k /SASLogon/oauth/token -H 'Content-Type: application/x-www-form-urlencoded' -d grant_type=client_credentials -u&lt;BR /&gt;client-E4AA2EA2841DC958350A18D59DDCF030:b24830bc88a9ce1fd28bffe3d31ba1d0ba5398701b31ef8730dd70ac5f9de027&lt;BR /&gt;&amp;gt; ++ grep -oP '{"access_token":"\K.*?(?=",")'&lt;BR /&gt;&amp;gt; + export OAUTH_TOKEN=&lt;BR /&gt;&amp;gt; + OAUTH_TOKEN=&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 20:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-a-macro-variable-to-a-linux-variable-in-a-shell/m-p/877776#M346763</guid>
      <dc:creator>naks02</dc:creator>
      <dc:date>2023-05-26T20:24:55Z</dc:date>
    </item>
  </channel>
</rss>

