<?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: Rename Tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626035#M258175</link>
    <description>&lt;P&gt;I assume that you already created a libref named LIBNAME pointing the LIBNAME schema in your remote database.&lt;/P&gt;
&lt;P&gt;So use PROC SQL to send your remote database's rename statement to the remote database to execute.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect using LIBNAME ;
execute by LIBNAME (
rename table libname.TEST_TRR_FINAL_BU5 
to TEST_TRR_FINAL_BU4
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 19 Feb 2020 23:59:43 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-02-19T23:59:43Z</dc:date>
    <item>
      <title>Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/101652#M258171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to rename tables which are in DB2 - however I keep getting errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets library=myfiles;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; change stock_apr=stock_apr12;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;/*error*/ SQL0108N The name "stock_apr12" has the wrong number of qualifiers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No luck with proc sql either:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to DB2 (datasrc=EDW user=tumtum password=123)&lt;/P&gt;&lt;P&gt;select * from connection to DB2&lt;/P&gt;&lt;P&gt;(rename table myfiles.stock_apr to myfiles.stock_apr12);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;/*error*/ SQL0108N The name "stock_apr12" has the wrong number of qualifiers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I normally manage to find solutions when I get stuck, but not this time around. I'd really appreciate some ideas from.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 12:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/101652#M258171</guid>
      <dc:creator>Tumtum</dc:creator>
      <dc:date>2012-08-22T12:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/101653#M258172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at: &lt;A href="http://support.sas.com/kb/44/089.html"&gt;http://support.sas.com/kb/44/089.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 12:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/101653#M258172</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-08-22T12:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/101654#M258173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arthur,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the feedback.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did have a look at that previosly. That led me to use the proq sql to generate an explicit pass-through. Unless I am completely missing something o_O&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 13:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/101654#M258173</guid>
      <dc:creator>Tumtum</dc:creator>
      <dc:date>2012-08-22T13:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626032#M258174</link>
      <description>&lt;P&gt;Hi. I am also looking for an answer to this question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using Toad, I simply type:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rename table libname.TEST_TRR_FINAL_BU5 
to TEST_TRR_FINAL_BU4;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, when I try to use the following code with SAS EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	rename table libname.TEST_TRR_FINAL_BU4 
	to TEST_TRR_FINAL_BU5;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get a complaint that the 'rename' statement is not valid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried following a convention I found online:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=libname;
change Test_TRR_FINAL_BU5=Test_TRR_Final_BU4;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This gives a complaint about the wrong number of qualifiers. I believe this is due to the error pointed out above. When I try to specify the libname, like so:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets;
change libname.Test_TRR_FINAL_BU5=Test_TRR_Final_BU4;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;SAS takes so long to complete the task that I force it to quit. I have been searching for a while for this answer, but this unanswered topic is the closest I have come to a solution.&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;</description>
      <pubDate>Wed, 19 Feb 2020 23:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626032#M258174</guid>
      <dc:creator>DGBK</dc:creator>
      <dc:date>2020-02-19T23:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626035#M258175</link>
      <description>&lt;P&gt;I assume that you already created a libref named LIBNAME pointing the LIBNAME schema in your remote database.&lt;/P&gt;
&lt;P&gt;So use PROC SQL to send your remote database's rename statement to the remote database to execute.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect using LIBNAME ;
execute by LIBNAME (
rename table libname.TEST_TRR_FINAL_BU5 
to TEST_TRR_FINAL_BU4
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Feb 2020 23:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626035#M258175</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-19T23:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626151#M258176</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick response. I think maybe we are getting close, but I am still getting an error. For full clarity, I am not actually using "libname" as my libname. I just put that in to hide the code a bit, which in hindsight was a stupid way to rename my code.&amp;nbsp; Also, I'm sure no one cares about the libnames I use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I first define libnames as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Libname act db2  Schema=Actuarial Datasrc=wedp15  authdomain="DefaultAuth";&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The code that I attempted from your suggestion was then:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	connect using act;
	execute by act (rename table ACT.TEST_TRR_FINAL_BU4 
	to TEST_TRR_FINAL_BU5);
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This returns the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: CLI execute error: [IBM][CLI Driver][DB2/AIX64] SQL0204N "ACT.TEST_TRR_FINAL_BU4" is an undefined name. SQLSTATE=42704&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that I have access to the table because&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
Create table test as
Select count(*) as Count
from act.Test_TRR_Final_BU4;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Do you have any other suggestions?&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;</description>
      <pubDate>Thu, 20 Feb 2020 14:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626151#M258176</guid>
      <dc:creator>DGBK</dc:creator>
      <dc:date>2020-02-20T14:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626155#M258177</link>
      <description>Looks like an error message from the remote database. Are you sure the syntax is correct?  Does that command work when connected to the database with another tools, like TOAD? Perhaps you need to include some other command to change your session state so it is closer to the state we get when connecting with TOAD?&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Feb 2020 14:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626155#M258177</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-02-20T14:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626239#M258178</link>
      <description>&lt;P&gt;Thanks for the help. Through numerous trials and errors, I successfully used the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	connect using act;
	execute by act (rename table actuarial.TEST_TRR_FINAL_BU4 
	to TEST_TRR_FINAL_BU5;);
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This means that from start to finish, the code went like this:&lt;CODE class=" language-sas"&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Libname act db2  Schema=Actuarial Datasrc=wedp15  authdomain="DefaultAuth";

Proc Sql;
	connect using act;
	execute by act (rename table actuarial.TEST_TRR_FINAL_BU4 
	to TEST_TRR_FINAL_BU5;);
Quit;&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>Thu, 20 Feb 2020 17:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rename-Tables/m-p/626239#M258178</guid>
      <dc:creator>DGBK</dc:creator>
      <dc:date>2020-02-20T17:54:05Z</dc:date>
    </item>
  </channel>
</rss>

