<?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: sasv9_local.cfg environment variables? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969750#M376935</link>
    <description>The Unix command line isn't aware of the SASApp / Lev1 structure, it does pickup the setting in !SASHOME/SASFoundation/9.4/sasv9_local.cfg but it won't resolve the $emailid, it keeps it as a literal.&lt;BR /&gt;&lt;BR /&gt;$ grep emailid SASFoundation/9.4/sasv9_local.cfg&lt;BR /&gt;-emailid $emailid&lt;BR /&gt;&lt;BR /&gt;However if I run this sas code from Unix:&lt;BR /&gt;%PUT MY_ENV_VAR = %SYSGET(emailid);&lt;BR /&gt;&lt;BR /&gt;I can see that emailid is being set by the sasenv_local (also a debug file is outputted).&lt;BR /&gt;&lt;BR /&gt;It works correctly in a SAS EG.</description>
    <pubDate>Wed, 25 Jun 2025 23:26:48 GMT</pubDate>
    <dc:creator>Anacreo</dc:creator>
    <dc:date>2025-06-25T23:26:48Z</dc:date>
    <item>
      <title>sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969742#M376931</link>
      <description>&lt;P&gt;I'm trying to pass an -emailid $emailid in my sasv9_local.cfg, I set the environment variable in the sasenv_local, and it is defintiely running and exporting the variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run this from SAS Enterprise Guide, it runs as expected.&lt;/P&gt;&lt;P&gt;If I run this from batch command line it won't use the environment variable, it just leaves emailid as the literal $emailid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this a bug or intentional?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 21:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969742#M376931</guid>
      <dc:creator>Anacreo</dc:creator>
      <dc:date>2025-06-25T21:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969747#M376934</link>
      <description>&lt;P&gt;You'll need to apply the change in your SASApp folder to&amp;nbsp;sasv9_usermods.cfg for this to also work for batch jobs.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 22:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969747#M376934</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-06-25T22:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969750#M376935</link>
      <description>The Unix command line isn't aware of the SASApp / Lev1 structure, it does pickup the setting in !SASHOME/SASFoundation/9.4/sasv9_local.cfg but it won't resolve the $emailid, it keeps it as a literal.&lt;BR /&gt;&lt;BR /&gt;$ grep emailid SASFoundation/9.4/sasv9_local.cfg&lt;BR /&gt;-emailid $emailid&lt;BR /&gt;&lt;BR /&gt;However if I run this sas code from Unix:&lt;BR /&gt;%PUT MY_ENV_VAR = %SYSGET(emailid);&lt;BR /&gt;&lt;BR /&gt;I can see that emailid is being set by the sasenv_local (also a debug file is outputted).&lt;BR /&gt;&lt;BR /&gt;It works correctly in a SAS EG.</description>
      <pubDate>Wed, 25 Jun 2025 23:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969750#M376935</guid>
      <dc:creator>Anacreo</dc:creator>
      <dc:date>2025-06-25T23:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969751#M376936</link>
      <description>&lt;P&gt;How do you execute SAS batch jobs then? The typical practice is to execute the sasbatch script that would be in /sasapp/batchserver in which case it will pick up SASApp modifications.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2025 23:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969751#M376936</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-06-25T23:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969755#M376938</link>
      <description>We will just execute !SASHOME/SASFoundation/9.4/bin/sas mysascode.sas&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jun 2025 23:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969755#M376938</guid>
      <dc:creator>Anacreo</dc:creator>
      <dc:date>2025-06-25T23:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969756#M376939</link>
      <description>&lt;P&gt;I suggest you try the sasbatch script as otherwise you will miss out on any config modifications.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2025 00:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969756#M376939</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-06-26T00:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969757#M376940</link>
      <description>We have a large configuration, I can definitely investigate it, but we're not setup that way today.  Would like to get the original problem solved.</description>
      <pubDate>Thu, 26 Jun 2025 01:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969757#M376940</guid>
      <dc:creator>Anacreo</dc:creator>
      <dc:date>2025-06-26T01:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969758#M376941</link>
      <description>&lt;P&gt;You need to set this environment variable at command line .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if you want environment variable&amp;nbsp;&lt;STRONG&gt;SAS_EXECFILEPATH&lt;/STRONG&gt;&amp;nbsp;has value "c:\sascode\" :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"D:\SASHome\SASFoundation\9.4\sas.exe" -nosplash -sysin "c:\temp\temp.sas"  -set &lt;STRONG&gt;SAS_EXECFILEPATH&lt;/STRONG&gt; "c:\sascode\"&lt;/PRE&gt;
&lt;P&gt;Check&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; blog:&lt;/P&gt;
&lt;P&gt;How to pass parameter into SAS programm:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/03/16/pass-params-sysget.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2025 01:20:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969758#M376941</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-06-26T01:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: sasv9_local.cfg environment variables?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969759#M376942</link>
      <description>&lt;P&gt;My full fix is below, I was hoping to skip the autoexec.sas and just do it in the sasv9_local.cfg with the -emailid = $emailid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This allows the system to set the user's proper FROM address instead of using a generic address and making users set it in their mail statement.&amp;nbsp; We set a default for service accounts that don't have individual email addresses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In !SASROOT/bin/sasenv_local&lt;/P&gt;
&lt;LI-CODE lang="shell"&gt;# Set default email
emailid="noreply@ourdomain.com"

# Path to the lookup file
lookup_file="/userid_email_lookup.txt"

# Read the file and find the matching email
while IFS='|' read -r user_id field2 email rest; do
    if [[ "$user_id" == "$USER" &amp;amp;&amp;amp; -n "$email" ]]; then
        emailid="$email"
        break
    fi
done &amp;lt; "$lookup_file"

# Optionally export it for use in other scripts
export emailid
&lt;/LI-CODE&gt;
&lt;P&gt;In sasv9_local.cfg&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;-autoexec !SASROOT/autoexec.sas&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;In !SASROOT/autoexec.sas&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;options emailid="%sysget(emailid)";&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks everyone for the participation!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jun 2025 01:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sasv9-local-cfg-environment-variables/m-p/969759#M376942</guid>
      <dc:creator>Anacreo</dc:creator>
      <dc:date>2025-06-26T01:20:55Z</dc:date>
    </item>
  </channel>
</rss>

