<?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 Why can't I have different Primary Key and Index in SAS Data Integration Studio? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646379#M193337</link>
    <description>&lt;P&gt;I have tables that I want to set its own primary key and index.&lt;/P&gt;&lt;P&gt;Most of the tables will use ID/RK as Primary Key whereas index will be ID/RK + STARTDT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS Data Integration Studio, setting ID/RK as primary key will also auto set ID/RK as index. If I want to set STARTDT as one of the indexes, it will prompt error saying primary key doesn't have STARTDT as key bla bla. I can provide the exact error message if you need. Only if i set STARTDT as primary key, index will auto include STARTDT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not what I want. If i copy the auto generated code from SAS DI and paste it in EG, i can set as below by executing script in SAS EG with slight modification on my own:&lt;BR /&gt;Primary key: ID/RK&lt;/P&gt;&lt;P&gt;Index: ID/RK + STARTDT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In DI Studio, there is no way for me to have Primary key as ID/RK while having ID/RK + STARTDT as index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or is there anyway or workaround for me to do so in SAS DI Studio?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 May 2020 13:16:54 GMT</pubDate>
    <dc:creator>WorkingMan</dc:creator>
    <dc:date>2020-05-09T13:16:54Z</dc:date>
    <item>
      <title>Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646379#M193337</link>
      <description>&lt;P&gt;I have tables that I want to set its own primary key and index.&lt;/P&gt;&lt;P&gt;Most of the tables will use ID/RK as Primary Key whereas index will be ID/RK + STARTDT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In SAS Data Integration Studio, setting ID/RK as primary key will also auto set ID/RK as index. If I want to set STARTDT as one of the indexes, it will prompt error saying primary key doesn't have STARTDT as key bla bla. I can provide the exact error message if you need. Only if i set STARTDT as primary key, index will auto include STARTDT.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not what I want. If i copy the auto generated code from SAS DI and paste it in EG, i can set as below by executing script in SAS EG with slight modification on my own:&lt;BR /&gt;Primary key: ID/RK&lt;/P&gt;&lt;P&gt;Index: ID/RK + STARTDT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In DI Studio, there is no way for me to have Primary key as ID/RK while having ID/RK + STARTDT as index.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or is there anyway or workaround for me to do so in SAS DI Studio?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 May 2020 13:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646379#M193337</guid>
      <dc:creator>WorkingMan</dc:creator>
      <dc:date>2020-05-09T13:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646454#M193386</link>
      <description>Isn't the PK unique?</description>
      <pubDate>Sun, 10 May 2020 05:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646454#M193386</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-10T05:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646456#M193388</link>
      <description>Yes PK is unique. But we want to optimize the loading speed to ensure it runs at the most efficient way. PK+STARTDT for index is based on past experience and best practice in other non-SAS environment.&lt;BR /&gt;&lt;BR /&gt;Is it a good practice/common way of having PK and index the same variable/column?</description>
      <pubDate>Sun, 10 May 2020 05:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646456#M193388</guid>
      <dc:creator>WorkingMan</dc:creator>
      <dc:date>2020-05-10T05:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646457#M193389</link>
      <description>&lt;P&gt;There is no point whatsoever in adding another variable to create a composite index that includes a unique variable.&lt;/P&gt;
&lt;P&gt;The unique variable identifies the one record to retrieve. The other variable serves no purpose.&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 05:45:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646457#M193389</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-10T05:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646461#M193392</link>
      <description>Now if you want to create another index that's a different matter. &lt;BR /&gt;</description>
      <pubDate>Sun, 10 May 2020 06:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646461#M193392</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-10T06:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646472#M193400</link>
      <description>Can i achieve this without running into error in SAS EG?&lt;BR /&gt;</description>
      <pubDate>Sun, 10 May 2020 08:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646472#M193400</guid>
      <dc:creator>WorkingMan</dc:creator>
      <dc:date>2020-05-10T08:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I have different Primary Key and Index in SAS Data Integration Studio?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646493#M193410</link>
      <description>&lt;P&gt;I don't know what you are trying to achieve,&lt;/P&gt;
&lt;P&gt;All this code is valid:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CLASS; 
  set SASHELP.CLASS;
run;
proc sql;
  alter table CLASS add primary key(SEX,NAME);
quit;
proc contents ; run;

data CLASS; 
  set SASHELP.CLASS;
run;
proc sql;
 alter table CLASS(index=(A=(NAME SEX))) add primary key(NAME);
quit;
proc contents ; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 May 2020 11:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-can-t-I-have-different-Primary-Key-and-Index-in-SAS-Data/m-p/646493#M193410</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-10T11:07:28Z</dc:date>
    </item>
  </channel>
</rss>

