<?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: Using IP address in X statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445713#M111803</link>
    <description>&lt;P&gt;Macro variables are not expanded within single quotes. They must appear within double quotes to be expanded in a string.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Mar 2018 14:56:53 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-03-15T14:56:53Z</dc:date>
    <item>
      <title>Using IP address in X statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445746#M111744</link>
      <description>&lt;P&gt;When I run Code 1, it works perfectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I replaced an IP address instead of D directory in code 2, but not work as expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I know why Code 2 is not working? Anyone can help on Code 2? Thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code 1:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%let cont=201802;&lt;BR /&gt;%put &amp;amp;cont;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;x "copy "d:\test\&amp;amp;cont\*.txt" "d:\" ";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code 2:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%let cont=201802;&lt;BR /&gt;%put &amp;amp;cont;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;x "copy "\\123.12.12.123\test\&amp;amp;cont\*.txt" "d:\" ";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 14:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445746#M111744</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2018-03-15T14:52:29Z</dc:date>
    </item>
    <item>
      <title>Using IP address in X statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445707#M111802</link>
      <description>&lt;P&gt;When I run Code 1, it didn't work, but it works perfectly for Code 2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I know why Code 1 is not working? Anyone can help on Code 1? Thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code 1:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%let cont=201802;&lt;BR /&gt;%put &amp;amp;cont;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;x 'copy "d:\test\&amp;amp;cont\*.txt" "d:\"';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Code 2:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;x 'copy "d:\test\201802\*.txt" "d:\"';&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 14:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445707#M111802</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2018-03-15T14:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using IP address in X statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445713#M111803</link>
      <description>&lt;P&gt;Macro variables are not expanded within single quotes. They must appear within double quotes to be expanded in a string.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 14:56:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445713#M111803</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-15T14:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using IP address in X statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445747#M111745</link>
      <description>&lt;P&gt;Since this is a OS command, first step is to try those from a prompt with the same user as in the SAS session.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 14:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445747#M111745</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-03-15T14:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using IP address in X statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445754#M111747</link>
      <description>&lt;P&gt;To see what external commands are &lt;EM&gt;really&lt;/EM&gt; doing, use the filename pipe method:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let cont=201802;
%put &amp;amp;cont;

filename oscmd pipe  "copy \\123.12.12.123\test\&amp;amp;cont.\*.txt d:\ 2&amp;gt;&amp;amp;1";

data _null_;
infile oscmd;
input;
put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS the X statement does not need a data _null_ around it.&lt;/P&gt;
&lt;P&gt;From the &lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=lestmtsglobal&amp;amp;docsetTarget=p11ba12uypvfazn1jk7acffuzlbl.htm&amp;amp;locale=en" target="_blank"&gt;documentation&lt;/A&gt;: "&lt;SPAN style="color: #333333; font-family: AvenirNext, Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"&gt;The X statement is a global statement and executes as a DATA step is being compiled.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;You can perfectly use it as a stand-alone statement, but it does not return any information besides &amp;amp;sysrc. The above code, OTOH, catches &lt;EM&gt;all&lt;/EM&gt; responses and writes them to the SAS log.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 14:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-IP-address-in-X-statement/m-p/445754#M111747</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-15T14:55:43Z</dc:date>
    </item>
  </channel>
</rss>

