<?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: Renaming indexes in PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473955#M121699</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table foo (
    id char(10) primary key
  );

  create table bar like foo;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 28 Jun 2018 02:15:58 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-06-28T02:15:58Z</dc:date>
    <item>
      <title>Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473915#M121673</link>
      <description>&lt;P&gt;I'm adding an primary key integrity constraint when creating a table.&amp;nbsp; Something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table foo (
    id char(10) primary key
  );
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This automatically adds an index with the name of "id".&amp;nbsp; My problem is I want to create another table in the same library with same primary key column name.&amp;nbsp; Doing something like this throws an error after running the previous code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table bar (
    id char(5) primary key
  );
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Would it be possible to rename the index from within PROC SQL?&amp;nbsp; Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table foo (
    id char(10) primary key
  );

  alter table foo
  modify index id rename to foo_id_idx;

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jun 2018 21:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473915#M121673</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2018-06-27T21:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473917#M121674</link>
      <description>&lt;P&gt;What error are you getting because when I run your code I don't get an error at all - here's my log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         proc sql;
 74         create table foo (
 75         id char(10) primary key);
 NOTE: Table WORK.FOO created, with 0 rows and 1 columns.
 76         quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.08 seconds
       cpu time            0.00 seconds
       
 78         proc sql;
 79         create table bar (
 80         id char(5) primary key);
 NOTE: Table WORK.BAR created, with 0 rows and 1 columns.
 81         quit;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 77         
 
 82         
 83         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 96         &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jun 2018 21:58:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473917#M121674</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-06-27T21:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473955#M121699</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create table foo (
    id char(10) primary key
  );

  create table bar like foo;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jun 2018 02:15:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/473955#M121699</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-06-28T02:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474074#M121754</link>
      <description>&lt;P&gt;I'm getting this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR: An index named id with the same definition but different characteristics exists for file SOMELIB.FOO.DATA.&lt;/PRE&gt;&lt;P&gt;All datasets are residing in a library and not in WORK if that makes a difference.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 13:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474074#M121754</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2018-06-28T13:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474075#M121755</link>
      <description>My real life table bar will have other constraints so it isn't a direct copy. Also the id column is a different length in bar.</description>
      <pubDate>Thu, 28 Jun 2018 13:51:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474075#M121755</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2018-06-28T13:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474519#M121931</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142145"&gt;@tomcmacdonald&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;My real life table bar will have other constraints so it isn't a direct copy. Also the id column is a different length in bar.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sound like the cause of the error like&lt;/P&gt;
&lt;PRE&gt;ERROR: An index named id with the same definition but different characteristics exists for file SOMELIB.FOO.DATA&lt;/PRE&gt;
&lt;P&gt;Length of the variable is a characteristic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And makes sense for keys. Since one set potentially could have xxxxxxxxxx as a value but one is limited to xxxx what should happen?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 17:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474519#M121931</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-29T17:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Renaming indexes in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474540#M121939</link>
      <description>&lt;P&gt;If the two id columns represent two different things e.g. customers and products then from a design point of view I would have thought it. better&amp;nbsp;to rename them to something like cust_id and prod_id to remove the danger of future confusion over which is being referenced.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jun 2018 18:12:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Renaming-indexes-in-PROC-SQL/m-p/474540#M121939</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2018-06-29T18:12:30Z</dc:date>
    </item>
  </channel>
</rss>

