<?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: Passing SAS variables to the UNIX kornshell in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32026#M7671</link>
    <description>Here is an example of what we are trying to do:&lt;BR /&gt;
&lt;BR /&gt;
******** shell&lt;BR /&gt;
#! /usr/bin/ksh&lt;BR /&gt;
set -o allexport&lt;BR /&gt;
&lt;BR /&gt;
export set z=0&lt;BR /&gt;
print $z&lt;BR /&gt;
sas sum.sas&lt;BR /&gt;
&lt;BR /&gt;
print $z&lt;BR /&gt;
&lt;BR /&gt;
set +o allexport&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
********** sum.sas&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  call system ('export set z=3');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
From within SAS we want to set an environment variable (Z) to 3 and print from shell.&lt;BR /&gt;
But it is coming back with zero not three.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your continued help!</description>
    <pubDate>Thu, 17 Dec 2009 16:41:02 GMT</pubDate>
    <dc:creator>SASHunter</dc:creator>
    <dc:date>2009-12-17T16:41:02Z</dc:date>
    <item>
      <title>Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32022#M7667</link>
      <description>This is my problem:  The kornshell will be running two SAS programs, the first will create a value that is stored in a variable.  The second SAS program needs this value to process other things.&lt;BR /&gt;
&lt;BR /&gt;
So is there a way to pass a SAS variable that was created in one SAS program back to the UNIX shell so that the next SAS program can use it?&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Thu, 17 Dec 2009 14:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32022#M7667</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2009-12-17T14:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32023#M7668</link>
      <description>Hi:&lt;BR /&gt;
  You might want to take a look at the documentation on using UNIX. It includes this section on environment variables:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/defenv.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/defenv.htm&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 17 Dec 2009 15:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32023#M7668</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-17T15:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32024#M7669</link>
      <description>We know how to get the variables from UNIX to the SAS program by way of the EXPORT command.  What I'm asking is how to update a UNIX variable from within SAS.&lt;BR /&gt;
&lt;BR /&gt;
Thanks so much.</description>
      <pubDate>Thu, 17 Dec 2009 16:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32024#M7669</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2009-12-17T16:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32025#M7670</link>
      <description>You can set UNIX environment variables from SAS, or you can use an external (sequential) file method to share "data" between independent SAS programs and/or other applications or OS functions.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument on your topic for consideration:&lt;BR /&gt;
&lt;BR /&gt;
set unix environment variable site:sas.com</description>
      <pubDate>Thu, 17 Dec 2009 16:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32025#M7670</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-17T16:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32026#M7671</link>
      <description>Here is an example of what we are trying to do:&lt;BR /&gt;
&lt;BR /&gt;
******** shell&lt;BR /&gt;
#! /usr/bin/ksh&lt;BR /&gt;
set -o allexport&lt;BR /&gt;
&lt;BR /&gt;
export set z=0&lt;BR /&gt;
print $z&lt;BR /&gt;
sas sum.sas&lt;BR /&gt;
&lt;BR /&gt;
print $z&lt;BR /&gt;
&lt;BR /&gt;
set +o allexport&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
********** sum.sas&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  call system ('export set z=3');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
----------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
From within SAS we want to set an environment variable (Z) to 3 and print from shell.&lt;BR /&gt;
But it is coming back with zero not three.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your continued help!</description>
      <pubDate>Thu, 17 Dec 2009 16:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32026#M7671</guid>
      <dc:creator>SASHunter</dc:creator>
      <dc:date>2009-12-17T16:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32027#M7672</link>
      <description>If the SAS execution behavior is not as documented/expected, suggest you contact SAS tech support for further assistance.  Useful DOC references specific to the SAS UNIX companion guide are provided below.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Companion for UNIX Environments, Executing Operating System Commands from Your SAS Session&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/xcomm.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/xcomm.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
SAS Companion for UNIX Environments, , CALL SYSTEM Routine: UNIX&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/callsys.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/callsys.htm&lt;/A&gt;</description>
      <pubDate>Thu, 17 Dec 2009 16:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32027#M7672</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-12-17T16:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Passing SAS variables to the UNIX kornshell</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32028#M7673</link>
      <description>I don't know the correct terminology but I think the problem is that when you run a SAS program it spawns another environment that inherits all the variables from the original.  I can create new variables and modify existing variables but I have been unable to have an effect on the original environment.  &lt;BR /&gt;
&lt;BR /&gt;
If the program that modifies or creates the environment variables starts the second program using SYSTASK perhaps then the variables created by program 1 are available.&lt;BR /&gt;
&lt;BR /&gt;
My shell is tcsh&lt;BR /&gt;
&lt;BR /&gt;
program 1.&lt;BR /&gt;
[pre]&lt;BR /&gt;
x setenv TESTENV hello;&lt;BR /&gt;
&lt;BR /&gt;
systask command "/usr/local/bin/sas testenv02.sas"; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Log from program 2.&lt;BR /&gt;
[pre]&lt;BR /&gt;
1          &lt;BR /&gt;
2          &lt;BR /&gt;
3          %put NOTE: %SYSGET(TESTENV);&lt;BR /&gt;
NOTE: hello&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
So, as was suggest is might be easier to communicate between programs with objects that you have complete control over, SAS data sets are good.&lt;BR /&gt;
&lt;BR /&gt;
I expect there is a way to get the environment variables to work and I look forward to learning the solution.</description>
      <pubDate>Thu, 17 Dec 2009 17:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-SAS-variables-to-the-UNIX-kornshell/m-p/32028#M7673</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-12-17T17:00:27Z</dc:date>
    </item>
  </channel>
</rss>

