<?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 Passing Parameters from SAS to Python Script in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874601#M345575</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello Team,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing this python script to upload the files to SFTP and I want to dynamically pass the file name as a macro variable. Unfortunately we can not use the submit block inside a macro function. Can someone please help me with a solution ? or an alternative way to SFTP the files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PROC Python.jpg" style="width: 608px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83736i73D2D2053F61970C/image-size/large?v=v2&amp;amp;px=999" role="button" title="PROC Python.jpg" alt="PROC Python.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 May 2023 05:44:36 GMT</pubDate>
    <dc:creator>Balli</dc:creator>
    <dc:date>2023-05-09T05:44:36Z</dc:date>
    <item>
      <title>Passing Parameters from SAS to Python Script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874601#M345575</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello Team,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing this python script to upload the files to SFTP and I want to dynamically pass the file name as a macro variable. Unfortunately we can not use the submit block inside a macro function. Can someone please help me with a solution ? or an alternative way to SFTP the files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PROC Python.jpg" style="width: 608px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83736i73D2D2053F61970C/image-size/large?v=v2&amp;amp;px=999" role="button" title="PROC Python.jpg" alt="PROC Python.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 05:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874601#M345575</guid>
      <dc:creator>Balli</dc:creator>
      <dc:date>2023-05-09T05:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Parameters from SAS to Python Script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874632#M345586</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153806"&gt;@Balli&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't call macro variables in the script that way, instead the macro variable needs to be passed using the SAS variable which is created as part of the PROC PYTHON session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should be able to use SAS.symget('') where you've highlighted the issue in your code in yellow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;see example from documentation below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let myvar = Jane Doe;

proc python;
submit;
x = SAS.symget('myvar')
print('macro variable myvar = ' + x)

py_var = 'Inside python'
SAS.symput('macrovar', py_var)
endsubmit;
run;

%put &amp;amp;=macrovar;
%put &amp;amp;=myvar;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 10:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874632#M345586</guid>
      <dc:creator>HarrySnart</dc:creator>
      <dc:date>2023-05-09T10:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Parameters from SAS to Python Script</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874806#M345660</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/335473"&gt;@HarrySnart&lt;/a&gt;&amp;nbsp;, works like a charm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 01:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Passing-Parameters-from-SAS-to-Python-Script/m-p/874806#M345660</guid>
      <dc:creator>Balli</dc:creator>
      <dc:date>2023-05-10T01:10:05Z</dc:date>
    </item>
  </channel>
</rss>

