<?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: DI Studio 4.2: creating indexes in user written code in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66605#M19023</link>
    <description>"...a transformation which replaces target table and creates index on it"...&lt;BR /&gt;
&lt;BR /&gt;
Why can't you use a table loader using a "replace" option?</description>
    <pubDate>Mon, 15 Mar 2010 15:01:44 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2010-03-15T15:01:44Z</dc:date>
    <item>
      <title>DI Studio 4.2: creating indexes in user written code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66603#M19021</link>
      <description>Hello!&lt;BR /&gt;
&lt;BR /&gt;
I'm designing a transformation which replaces target table and creates index on it. Target table, that is connected to output port of transform has defined index, but I can't write the "create index" statement in the transformation, because there is no any information about indexes in macro variables, automatically generated in my transformation.&lt;BR /&gt;
&lt;BR /&gt;
How can I get information about index on target table from transform?</description>
      <pubDate>Wed, 10 Mar 2010 14:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66603#M19021</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-10T14:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio 4.2: creating indexes in user written code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66604#M19022</link>
      <description>If you want to rely on what definitions resides in metadata, you'll probably have to connect to the metadata server and retrieve the index spec using the functions metadata_getnobj, metadata_getattr and metadata_getnasn.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 15 Mar 2010 08:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66604#M19022</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2010-03-15T08:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio 4.2: creating indexes in user written code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66605#M19023</link>
      <description>"...a transformation which replaces target table and creates index on it"...&lt;BR /&gt;
&lt;BR /&gt;
Why can't you use a table loader using a "replace" option?</description>
      <pubDate>Mon, 15 Mar 2010 15:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66605#M19023</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-03-15T15:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio 4.2: creating indexes in user written code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66606#M19024</link>
      <description>Patrick, source and target tables are both stored in relational database, and table loader passes data through SAS, and this causes extra data transmissions between servers. My transform only passes "create table as select * ..." to database.</description>
      <pubDate>Thu, 18 Mar 2010 09:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66606#M19024</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-03-18T09:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio 4.2: creating indexes in user written code</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66607#M19025</link>
      <description>Igor&lt;BR /&gt;
&lt;BR /&gt;
I'm not 100% sure that if source and target are in the same DB that the code generated by the "Table Loader" results in data passing via the SAS Server from Source to Target.&lt;BR /&gt;
&lt;BR /&gt;
A lot of SAS code is translated into DBMS specific SQL during SAS execution. I would know the option for Oracle to get in the SAS log what's really sent to the DB for execution (what DBMS are you using?).&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Another approach would be to use a "SQL Join" transform.&lt;BR /&gt;
&lt;BR /&gt;
I did the following test:&lt;BR /&gt;
&lt;BR /&gt;
1. Job with Source and Target table (index on target table)&lt;BR /&gt;
2. "SQL Join" transform&lt;BR /&gt;
3. Connect Source to "SQL Join"&lt;BR /&gt;
4. Delete output table on "SQL Join" (this green little table on the right side of the transform).&lt;BR /&gt;
5. Connect "SLQ Join" to Target&lt;BR /&gt;
6. In "SQL Join" designer: Delete  "Join" object.&lt;BR /&gt;
7. In "SLQ Join" designer: Connect Source to "Select" object&lt;BR /&gt;
&lt;BR /&gt;
The resulting code looked good to me. Both the PROC SQL part creating  and loading the target table and the PROC DATASETS part creating the index after the data gets loaded looked fine to me. The code will execute on the DB.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I believe to use a "User Written Code" node or to create a "User Tranformation" should be the last measure if there are no other means to solve a DI challenge.&lt;BR /&gt;
.....I already created quite a lot of both of these objects.... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;   &lt;BR /&gt;
&lt;BR /&gt;
In your case: It's not only about indexes but also about constraints. The only way I can think of to create this manually is to query the metadata and then based on the result to create the code on-the-fly. This would be quite a task.&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Thu, 18 Mar 2010 10:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DI-Studio-4-2-creating-indexes-in-user-written-code/m-p/66607#M19025</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-03-18T10:45:09Z</dc:date>
    </item>
  </channel>
</rss>

