<?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: Writing Python inside SAS 9.4 in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859618#M26019</link>
    <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34991"&gt;@nstdt&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The SAS documentation requires creating environment variables at the operating system level rather then run the set command in the SAS EG as you have shown in the error message.&lt;BR /&gt;In case you are using Windows, You can either run from the command line or set the environment variable in the GUI. For this open up all settings and in the window that opens type Environment variables. There are a number of tutorials on google for this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Feb 2023 14:47:16 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2023-02-19T14:47:16Z</dc:date>
    <item>
      <title>Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859568#M26003</link>
      <description>&lt;P&gt;I need to use Python within SAS 9.4.&lt;/P&gt;
&lt;P&gt;I have Anaconda installed on my laptop. The IT in my organisation was unable to help me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the process to start using Python from&amp;nbsp;SAS 9.4.?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could anyone advice me on what additional SAS modules or extensions I need?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 21:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859568#M26003</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-18T21:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859571#M26004</link>
      <description>&lt;P&gt;There are some tips in this thread:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Executing-python-code-from-SAS-Environment/td-p/769649" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Executing-python-code-from-SAS-Environment/td-p/769649&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 23:12:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859571#M26004</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-02-18T23:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859575#M26005</link>
      <description>&lt;P&gt;Python must be installed on a machine where SAS can call it. That's not the machine where your SAS client runs but where the SAS Server executes the SAS code.&lt;/P&gt;
&lt;P&gt;I've done something like this a few months back in a SAS9.4 environment. Python was already installed on the server but I had to request additional libraries. Anaconda is certainly not installed and something you would need to request from your IT department/SAS Admins.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my case integration between SAS and Python was very simple: SAS did the data prep and created a SAS table, then I just called the Python program via call system() that then read the SAS table via Pandas and did its thing (in my case created an Excel workbook with functionality like drop down validation that I couldn't do with SAS).&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 00:44:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859575#M26005</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-19T00:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859576#M26006</link>
      <description>&lt;P&gt;Thanks for the reply. When you say "&lt;SPAN&gt;That's not the machine where your SAS client runs but where the SAS Server executes the SAS code" - I assume you mean that Python needs to be installed in the Server , not just my laptop (I am not even very sure what a server is, but I do know it's not my local laptop). I guess I must call the IT desk and ask them if they have Python in the server used by my department. If I'm missing anything, please let me know.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, as the other response mentioned, I tried following the suggestions here:&lt;A href="https://go.documentation.sas.com/doc/en/bicdc/9.4/biasag/n1mquxnfmfu83en1if8icqmx8cdf.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/bicdc/9.4/biasag/n1mquxnfmfu83en1if8icqmx8cdf.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and typed in the commands given there&amp;nbsp; into SAS but only get these Error messages in the Log:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    set MAS_M2PATH="C:\SASServer\SASHome\SASFoundation\9.4\tkmas\sasmisc\mas2py.py"
     ---
     180
ERROR 180-322: Statement is not valid or it is used out of proper order.

2    set MAS_PYPATH="c:\python\python.exe"
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 00:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859576#M26006</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-19T00:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859577#M26007</link>
      <description>&lt;P&gt;Yes, not your laptop unless you've got a local SAS installation which becomes rarer and rarer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get the name of the server where SAS executes by issuing below in a SAS command Window&lt;/P&gt;
&lt;PRE&gt;%put &amp;amp;=syshostname;&lt;/PRE&gt;
&lt;P&gt;The set commands are OS commands that create and populate OS level environment variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also create and populate such variables out of a SAS session using EXAMPLE code like below. ...don't execute it. The path must match your environment, and it's best done by an Admin as part of environment configuration.&lt;/P&gt;
&lt;PRE&gt;options SET=MAS_PYPATH="c:\python\python.exe";&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Feb 2023 01:53:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859577#M26007</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-19T01:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859578#M26008</link>
      <description>&lt;P&gt;Hmm, in my case, I may actually have a local SAs installation - but I really don't know for sure.&lt;/P&gt;
&lt;P&gt;I tried your put code - does this mean anything to you? Thanks again!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1    %put &amp;amp;=syshostname;
SYSHOSTNAME=DESKTOP-JU738BM


&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 01:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859578#M26008</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-19T01:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859583#M26010</link>
      <description>&lt;P&gt;This could indicate that you are running SAS locally which then also would mean you can call your local Python.&lt;/P&gt;
&lt;P&gt;What client are you using for running SAS? EG, Studio, "PC SAS"?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If using EG is the server you're connecting to called "local"?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 02:39:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859583#M26010</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-19T02:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859584#M26011</link>
      <description>&lt;P&gt;It's not EG for sure. I think it's PC SAS. I just pull it up from my Start menu on Windows , on my personal laptop. There's no official password or anything, although it was installed through my work department.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 02:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859584#M26011</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-19T02:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859586#M26012</link>
      <description>&lt;P&gt;I can see this as well:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nstdt_0-1676774813818.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80576iD3BE94D1BB4F7715/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nstdt_0-1676774813818.png" alt="nstdt_0-1676774813818.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 02:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859586#M26012</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-19T02:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859597#M26013</link>
      <description>&lt;P&gt;Then you're at luck. You're using the old fashioned display manager that sits right on top of SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends a bit what you want to do with Python but if it's something as simple as what I did then it's just about calling Python out of SAS via a call system() or X command or similar.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 05:54:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859597#M26013</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-19T05:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859598#M26014</link>
      <description>&lt;P&gt;Does this &lt;A href="https://communities.sas.com/t5/SAS-Programming/Execute-Python-code-within-SAS-Enterprise-Guide/m-p/839311" target="_blank" rel="noopener"&gt;post&lt;/A&gt; help - the code examples should work equally as well for you.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 06:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859598#M26014</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-02-19T06:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859618#M26019</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34991"&gt;@nstdt&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The SAS documentation requires creating environment variables at the operating system level rather then run the set command in the SAS EG as you have shown in the error message.&lt;BR /&gt;In case you are using Windows, You can either run from the command line or set the environment variable in the GUI. For this open up all settings and in the window that opens type Environment variables. There are a number of tutorials on google for this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 14:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/859618#M26019</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2023-02-19T14:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860057#M26048</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;Since I have SAS9.4 installed on my local Windows machine,&amp;nbsp;I tried setting the environment variables&amp;nbsp; as follows:&lt;/P&gt;
&lt;P&gt;MAS_PYPATH =&amp;nbsp;C:\Users\radhi\AppData\Local\Programs\Python\Python310\python.exe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;MAS_M2PATH =&amp;nbsp;&lt;/SPAN&gt;C:\Program Files\SASHome\SASFoundation\9.4\tkmas\sasmisc\mas2py.py&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then I tried running the SAS code from their help pages to check:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc fcmp;
declare object py(python);
submit into py;
def PyProduct(var1, var2):
    "Output: MyKey"
    newvar = var1 * var2
    return newvar,
endsubmit;
rc = py.publish();
rc = py.call("PyProduct", 5, 10);
MyResult = py.results["MyKey"];
put MyResult=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, the SAS log shows the following errors:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: Module 'py' failed to compile in user context 'CMP User Thread'.
NOTE: Module 'py' compilation errors: 
ERROR: MAS_PYPATH environment variable is undefined.
ERROR:
      tkmaspyPublish encountered a failure in tkmaspyConnect, rc=0x803FC26A.
ERROR: masPublish encountered a failure.
ERROR: Foreign Language Compilation messages:
ERROR: Python compile: ERROR: MAS_PYPATH environment variable is undefined.
ERROR: Python compile: ERROR: tkmaspyPublish encountered a failure in tkmaspyConnect,
       rc=0x803FC26A.
ERROR: Unable to publish program for foreign language execution.
ERROR: Error reported in function 'python:PUBLISH' in statement number 4 at line 80 column 1.
       The statement was:
    1     (80:1)     rc = python:PUBLISH(  )
NOTE: PROCEDURE FCMP used (Total process time):
      real time           0.14 seconds
      cpu time            0.06 seconds
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Any idea what may be going wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 02:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860057#M26048</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-22T02:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860059#M26049</link>
      <description>&lt;P&gt;&amp;nbsp;edited the PYPATH as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;C:\Users\radhi\anaconda3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but still get errors as below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: Module 'py' failed to compile in user context 'CMP User Thread'.
NOTE: Module 'py' compilation errors: 
ERROR: MAS_PYPATH environment variable is undefined.
ERROR:
      tkmaspyPublish encountered a failure in tkmaspyConnect, rc=0x803FC26A.
ERROR: masPublish encountered a failure.
ERROR: Foreign Language Compilation messages:
ERROR: Python compile: ERROR: MAS_PYPATH environment variable is undefined.
ERROR: Python compile: ERROR: tkmaspyPublish encountered a failure in tkmaspyConnect,
       rc=0x803FC26A.
ERROR: Unable to publish program for foreign language execution.
ERROR: Error reported in function 'python:PUBLISH' in statement number 4 at line 94 column 1.
       The statement was:
    1     (94:1)     rc = python:PUBLISH(  )
NOTE: PROCEDURE FCMP used (Total process time):
      real time           0.13 seconds
      cpu time            0.09 seconds

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2023 02:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860059#M26049</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-22T02:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860066#M26050</link>
      <description>&lt;P&gt;Sorry to hear about the error.&lt;BR /&gt;&lt;BR /&gt;The error "ERROR: MAS_PYPATH environment variable is undefined." implies &lt;BR /&gt;that this environment variable is not available.&lt;BR /&gt;The environment variable must be defined either as a system environment &lt;BR /&gt;variable OR as the user running the SAS code.&lt;BR /&gt;Defining system environment variable requires administrator privileges. &lt;BR /&gt;On a Desktop this must be done as an administrator user.&lt;BR /&gt;&lt;BR /&gt;The value of environment variable *MAS_PYPATH* should be the full path &lt;BR /&gt;to the location where python interpreter "python.exe" is actually &lt;BR /&gt;installed.Please add this location of python interpreter to the PATH &lt;BR /&gt;environment variable too.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 04:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860066#M26050</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2023-02-22T04:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860079#M26051</link>
      <description>&lt;P&gt;You must set the environment variables in the SAS startup script, not in a separate cmd window.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 06:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860079#M26051</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-22T06:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860109#M26054</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34991"&gt;@nstdt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;was talking about&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.Create a Windows batch script in a desired directory (&lt;STRONG&gt;pyfromsas.bat&lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;2.Inside that&amp;nbsp;&lt;STRONG&gt;pyfromsas.bat&lt;/STRONG&gt;&amp;nbsp;file, add the following lines&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;REM echo off&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;set MAS_M2PATH=&lt;FONT color="#FF0000"&gt;&amp;lt;C:\Program Files\SASHome\SASFoundation\9.4&amp;gt;&lt;/FONT&gt;\tkmas\sasmisc\mas2py.py&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;set MAS_PYPATH=C:\&amp;lt;&lt;/STRONG&gt;&lt;STRONG&gt;InstallationPath&lt;/STRONG&gt;&lt;STRONG&gt;&amp;gt;\python.exe&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;"&lt;FONT color="#FF0000"&gt;&amp;lt;C:\Program Files\SASHome\SASFoundation\9.4&amp;gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;\sas.exe" -CONFIG "&lt;FONT color="#FF0000"&gt;&amp;lt;C:\Program Files\SASHome\SASFoundation\9.4&amp;gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;STRONG&gt;nls&lt;/STRONG&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;STRONG&gt;en&lt;/STRONG&gt;&lt;STRONG&gt;\sasv9.cfg“&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;3.Save the &lt;STRONG&gt;pyfromsas.bat&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;4.Run the script&lt;/P&gt;
&lt;P&gt;&amp;nbsp; C:\&amp;gt; &amp;lt;path&amp;gt;\&lt;STRONG&gt;pyfromsas.bat&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note: Change the&amp;nbsp;&lt;FONT color="#FF0000"&gt;&amp;lt;C:\Program Files\SASHome\SASFoundation\9.4&amp;gt; &lt;FONT color="#000000"&gt;to match&amp;nbsp;the installation directory of the SAS software on your&amp;nbsp;machine.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Hope this&amp;nbsp;helps,&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Ahmed&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 10:19:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860109#M26054</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-02-22T10:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860151#M26058</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks Ahmed, I will try out your suggestions soon. I had some questions though -&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;When you say :&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;1.Create a Windows batch script in a desired directory (&lt;STRONG&gt;pyfromsas.bat&lt;/STRONG&gt;) - &lt;/EM&gt;what is this desired directory? Where do I put the pyfromsas.bat file? Does it matter or can it be anywhere?&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. When you say:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Change the&amp;nbsp;&lt;FONT color="#FF0000"&gt;&amp;lt;C:\Program Files\SASHome\SASFoundation\9.4&amp;gt;&lt;FONT color="#000000"&gt;to match&amp;nbsp;the installation directory of the SAS software on your&amp;nbsp;machine. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;:\Program Files\SASHome\SASFoundation\9.4 actually is part of the installation path, because my version of SAS9.4 has been installed locally on my own laptop. So I don't need to change that, do I?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Here is where Windos search bar locates SAS on my laptop:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;C:\ProgramData\Microsoft\Windows\Start Menu\Programs\SAS&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;Thank you&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 12:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860151#M26058</guid>
      <dc:creator>nstdt</dc:creator>
      <dc:date>2023-02-22T12:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860163#M26060</link>
      <description>Desired directory --&amp;gt; means you can save it wherever you want.&lt;BR /&gt;&lt;BR /&gt;If the installation location matches your settings, then no change required.</description>
      <pubDate>Wed, 22 Feb 2023 13:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/860163#M26060</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2023-02-22T13:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Writing Python inside SAS 9.4</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/962055#M29759</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I added the MAS_PYPATH to Win11 env. variables and now I get a new error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ERROR: Module 'py' failed to compile in user context 'CMP User Thread'.&lt;BR /&gt;NOTE: Module 'py' compilation errors: &lt;BR /&gt;ERROR: MAS_M2PATH environment variable is&lt;BR /&gt;undefined.&lt;BR /&gt;ERROR: tkmaspyPublish encountered a failure in tkmaspyConnect, rc=0x803FC26A.&lt;BR /&gt;ERROR: masPublish encountered a failure.&lt;BR /&gt;ERROR: Foreign Language Compilation messages:&lt;BR /&gt;ERROR: Python compile: ERROR: &lt;STRONG&gt;MAS_M2PATH&lt;/STRONG&gt; environment variable is undefined.&lt;BR /&gt;ERROR: Python compile: ERROR: tkmaspyPublish encountered a failure in tkmaspyConnect,&lt;BR /&gt;rc=0x803FC26A.&lt;BR /&gt;ERROR: Unable to publish program for foreign language execution.&lt;BR /&gt;ERROR: Error reported in function 'python:PUBLISH' in statement number 4 at line 15 column 1.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;However, I can not find any reference in documentation to this env. variable ( MAS_M2PATH)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 09:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Writing-Python-inside-SAS-9-4/m-p/962055#M29759</guid>
      <dc:creator>TimBedsted</dc:creator>
      <dc:date>2025-03-18T09:56:59Z</dc:date>
    </item>
  </channel>
</rss>

