<?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 Quoting on SYSTASK command in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340295#M77753</link>
    <description>&lt;P&gt;I would like to seek help on my script regarding quotes in my systask command; The command string is actually built the way I want it but when it gets resolved in the systask command it already breaks. I need to nrquote&amp;nbsp;the variables I have as it can be possible there are spaces in the paths and filenames.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greatly appreciate your help. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let pyscripts=C:\pyscripts;
%let sourcefile=sample.csv;
%let targettable=sample;

/* Build string for command line execution */
%let command = activate myenv%nrstr(&amp;amp;&amp;amp;) python %nrquote("&amp;amp;pyscripts\load_source_file.py") %nrquote("&amp;amp;sourcefile") %nrquote("&amp;amp;targettable");
%put &amp;amp;command;

/* Call python script for loading files*/
systask command "&amp;amp;command"
	status=loadstat
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Mar 2017 03:15:53 GMT</pubDate>
    <dc:creator>milts</dc:creator>
    <dc:date>2017-03-13T03:15:53Z</dc:date>
    <item>
      <title>Quoting on SYSTASK command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340295#M77753</link>
      <description>&lt;P&gt;I would like to seek help on my script regarding quotes in my systask command; The command string is actually built the way I want it but when it gets resolved in the systask command it already breaks. I need to nrquote&amp;nbsp;the variables I have as it can be possible there are spaces in the paths and filenames.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greatly appreciate your help. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let pyscripts=C:\pyscripts;
%let sourcefile=sample.csv;
%let targettable=sample;

/* Build string for command line execution */
%let command = activate myenv%nrstr(&amp;amp;&amp;amp;) python %nrquote("&amp;amp;pyscripts\load_source_file.py") %nrquote("&amp;amp;sourcefile") %nrquote("&amp;amp;targettable");
%put &amp;amp;command;

/* Call python script for loading files*/
systask command "&amp;amp;command"
	status=loadstat
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 03:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340295#M77753</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2017-03-13T03:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting on SYSTASK command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340337#M77770</link>
      <description>&lt;P&gt;Your macro variable command resolves to this:&lt;/P&gt;
&lt;PRE&gt;activate myenv&amp;amp;&amp;amp; python "C:\pyscripts\load_source_file.py" "sample.csv" "sample"&lt;/PRE&gt;
&lt;P&gt;in the systask statement, this resolves to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;systask command "activate myenv&amp;amp;&amp;amp; python "C:\pyscripts\load_source_file.py" "sample.csv" "sample""
	status=loadstat
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So your command is just&lt;/P&gt;
&lt;PRE&gt;activate myenv&amp;amp;&amp;amp; python &lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE&gt;C:\pyscripts\load_source_file.py&lt;/PRE&gt;
&lt;P&gt;is misinterpreted as part of the systask statement parameters.&lt;/P&gt;
&lt;P&gt;I suggest you use double double quotes where needed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let command = activate myenv%nrstr(&amp;amp;&amp;amp;) python %nrquote(""&amp;amp;pyscripts\load_source_file.py"") %nrquote(""&amp;amp;sourcefile"") %nrquote(""&amp;amp;targettable"");
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or you start kicking people in the behind who have blanks in their filenames.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2017 09:10:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340337#M77770</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-13T09:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: Quoting on SYSTASK command</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340626#M77873</link>
      <description>&lt;P&gt;Thanks a lot for the help. The double quoting works and lets me execute the python script properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, and the second suggestion works as well!! Will definitely impose that one!&amp;nbsp;&lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://communities.sas.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 02:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Quoting-on-SYSTASK-command/m-p/340626#M77873</guid>
      <dc:creator>milts</dc:creator>
      <dc:date>2017-03-14T02:30:50Z</dc:date>
    </item>
  </channel>
</rss>

