<?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: Error while using rename function. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333543#M75176</link>
    <description>And the log showing the error message?</description>
    <pubDate>Thu, 16 Feb 2017 19:23:00 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2017-02-16T19:23:00Z</dc:date>
    <item>
      <title>Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333525#M75162</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to rename a .txt file on my desktop. I ran the below code but I got the error that 'Invalid file name'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please let me know what I am doing wrong:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tt;&lt;BR /&gt; &lt;BR /&gt;rc=rename('C:\Users\user1\Desktop\Test\testf.txt', 'C:\Users\archive\test2.txt', 'file');&lt;BR /&gt; &lt;BR /&gt; put 'RC:' rc;&lt;BR /&gt;if rc then _msg_=sysmsg();&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 18:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333525#M75162</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-02-16T18:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333528#M75164</link>
      <description>&lt;P&gt;Are you forgetting a username in the first argument of the rename function?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I.e.&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;rc=rename('C:\Users\&lt;FONT color="#ff0000"&gt;&lt;U&gt;&lt;STRONG&gt;myusername\&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;Desktop\Test\testf.txt', 'C:\Users\archive\test2.txt', 'file');&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;rc=rename('C:\Users\&lt;FONT color="#ff0000"&gt;&lt;U&gt;&lt;STRONG&gt;myusername\&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;Desktop\Test\testf.txt', 'C:\Users\&lt;FONT color="#ff0000"&gt;&lt;U&gt;&lt;STRONG&gt;myusername\&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;archive\test2.txt', 'file');&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:21:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333528#M75164</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-16T19:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333531#M75165</link>
      <description>&lt;P&gt;If SAS is just calling the native Windows RENAME command then it does not allow changing the path of the file. Just the name of the file in the same directory.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 18:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333531#M75165</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-02-16T18:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333532#M75166</link>
      <description>&lt;P&gt;I used this code to successfully "rename" a file from c:\temp\t.txt&amp;nbsp; to c:\temp\tmp\t.txt, so I guess it's not actually calling the windows rename command.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 18:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333532#M75166</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-16T18:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333533#M75167</link>
      <description>&lt;P&gt;For some reason my code is not working. I tried renaming a directory and it worked but not the file renaming.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333533#M75167</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-02-16T19:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333536#M75169</link>
      <description>&lt;P&gt;Post your code and log.&lt;/P&gt;
&lt;P&gt;What version of SAS are you using, are you certain the function is available in your version?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333536#M75169</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-16T19:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333540#M75173</link>
      <description>&lt;P&gt;I noticed that you added the username (i.e., user1) in the from name, but you didn't do that for the to name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;rc=rename('C:\Users\user1\Desktop\Test\testf.txt', 'C:\Users\archive\test2.txt', 'file');&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Should the to name have been:&amp;nbsp;C:\Users\user1\archive\test2.txt' abd does that directory exist (i.e.,&amp;nbsp;C:\Users\user1\archive )?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Art, CEO, AnalystFinder.com&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333540#M75173</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-16T19:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333541#M75174</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I noticed that you added the username (i.e., user1) in the from name, but you didn't do that for the to name:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;rc=rename('C:\Users\user1\Desktop\Test\testf.txt', 'C:\Users\archive\test2.txt', 'file');&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Should the to name have been:&amp;nbsp;C:\Users\user1\archive\test2.txt' abd does that directory exist (i.e.,&amp;nbsp;C:\Users\user1\archive )?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Art, CEO, AnalystFinder.com&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Absolutely!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will modify my note.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333541#M75174</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-16T19:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333542#M75175</link>
      <description>&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data tt;&lt;BR /&gt; rc=rename('C:\Users\user1\Desktop\Test\testf.txt', 'C:\Users\user1\Desktop\Test\test2.txt', 'file');&lt;BR /&gt; put 'RC:' rc;&lt;BR /&gt;if rc then _msg_=sysmsg();&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using SAS 9.4&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333542#M75175</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-02-16T19:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333543#M75176</link>
      <description>And the log showing the error message?</description>
      <pubDate>Thu, 16 Feb 2017 19:23:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333543#M75176</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-16T19:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333545#M75177</link>
      <description>&lt;P&gt;Here you go:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;682 data tt;&lt;BR /&gt;1683 rc=rename('C:\Users\user1\Desktop\Test\testf.txt', 'C:\Users\user1\Desktop\Test\test2.txt',&lt;BR /&gt;1683! 'file');&lt;BR /&gt;1684 put 'RC:' rc;&lt;BR /&gt;1685 if rc then _msg_=sysmsg();&lt;BR /&gt;1686 put _msg_;&lt;BR /&gt;1687&lt;BR /&gt;1688 run;&lt;/P&gt;
&lt;P&gt;RC:1&lt;BR /&gt;ERROR: Invalid physical name.&lt;BR /&gt;NOTE: The data set WORK.TT has 1 observations and 2 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt; real time 0.01 seconds&lt;BR /&gt; cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333545#M75177</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-02-16T19:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333547#M75178</link>
      <description>&lt;P&gt;Thank you for posting the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some conjectures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Are you running the program under the userid whose desktop contents is being renamed.&amp;nbsp; Would that create a permission issue masquerading as a physical file not exist message?&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Is your desktop screen showing a shortcut instead of a file?&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Is the file really there?&amp;nbsp; Perhaps you could pipe input from&amp;nbsp;a dir command to see if the dataset name is exactly as the rename command expects?&amp;nbsp; I.e.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename dslist pipe 'dir/b c:\Users\user1\Desktop\Test';&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; data filenames;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile dslist&amp;nbsp; truncover;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input fname :$60.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fname='testf.txt' then found=1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; put fname=;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&lt;BR /&gt;If found never=1 then I guess the file really isn't there.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;xx&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333547#M75178</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-16T19:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333550#M75180</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;. The function even works on SAS UniversityEdition. e.g. the following worked perfectly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data tt;
  rc=rename('/folders/myfolders/users/user1/desktop/test/testf.txt', '/folders/myfolders/users/user1/desktop/test/test2.txt', 'file');
  put 'RC:' rc;
  if rc then _msg_=sysmsg();
run;
;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 19:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333550#M75180</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-16T19:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error while using rename function.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333555#M75183</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;for your suggestions. Yes, the file name was wrong..the extension was .txt' instead of .txt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I changed it and now it is working fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2017 20:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-while-using-rename-function/m-p/333555#M75183</guid>
      <dc:creator>renjithr</dc:creator>
      <dc:date>2017-02-16T20:01:35Z</dc:date>
    </item>
  </channel>
</rss>

