<?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: How to create a surrogate key or auto increment ID in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61439#M6209</link>
    <description>Thank you Derek,&lt;BR /&gt;
&lt;BR /&gt;
I saw in another thread that the monotonic function is undocumented and can cause unexpected results........&lt;BR /&gt;
&lt;BR /&gt;
Is that right or i can use it without lost or corrupt data ?</description>
    <pubDate>Tue, 04 Aug 2009 19:27:37 GMT</pubDate>
    <dc:creator>DarthSAS</dc:creator>
    <dc:date>2009-08-04T19:27:37Z</dc:date>
    <item>
      <title>How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61437#M6207</link>
      <description>Hi all&lt;BR /&gt;
&lt;BR /&gt;
I'm very new to the SAS World, but i have a little experience on t-sql. What i want to do is create a table or a data set with with an unique ID with an auto increment like t-sql do or a sequence like Oracle but with SAS.&lt;BR /&gt;
&lt;BR /&gt;
I've heard of a surrogate key. Can i create un surrogate key to do this functionality ?</description>
      <pubDate>Tue, 04 Aug 2009 16:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61437#M6207</guid>
      <dc:creator>DarthSAS</dc:creator>
      <dc:date>2009-08-04T16:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61438#M6208</link>
      <description>Try using monotonic() in proc sql, i.e monotonic() as xxx or if using a datastep xxx = _n_;</description>
      <pubDate>Tue, 04 Aug 2009 19:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61438#M6208</guid>
      <dc:creator>DerekAdams</dc:creator>
      <dc:date>2009-08-04T19:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61439#M6209</link>
      <description>Thank you Derek,&lt;BR /&gt;
&lt;BR /&gt;
I saw in another thread that the monotonic function is undocumented and can cause unexpected results........&lt;BR /&gt;
&lt;BR /&gt;
Is that right or i can use it without lost or corrupt data ?</description>
      <pubDate>Tue, 04 Aug 2009 19:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61439#M6209</guid>
      <dc:creator>DarthSAS</dc:creator>
      <dc:date>2009-08-04T19:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61440#M6210</link>
      <description>I havent had any issues so far so I can't really comment on that at the moment</description>
      <pubDate>Tue, 04 Aug 2009 20:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61440#M6210</guid>
      <dc:creator>DerekAdams</dc:creator>
      <dc:date>2009-08-04T20:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61441#M6211</link>
      <description>Hi:&lt;BR /&gt;
  This is the Tech Support note on the use of the MONOTONIC function:&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/15/138.html" target="_blank"&gt;http://support.sas.com/kb/15/138.html&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
  The full text of the note says:&lt;BR /&gt;
&lt;B&gt;&lt;BR /&gt;
The MONOTONIC() function is not supported in PROC SQL.  Using the&lt;BR /&gt;
MONOTONIC() function in PROC SQL can cause missing or non-sequential&lt;BR /&gt;
values to be returned.&lt;BR /&gt;
&lt;/B&gt;&lt;BR /&gt;
       &lt;BR /&gt;
  To me, this means that if you do use the MONOTONIC function, then you can't complain when/if it doesn't return sequential numbers.. I suspect that for simple, simple queries, you might be OK, but for more complex queries that involve joins and where clauses, you might get into the missing or non-sequential values.&lt;BR /&gt;
 &lt;BR /&gt;
My .02,&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 04 Aug 2009 23:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61441#M6211</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-08-04T23:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61442#M6212</link>
      <description>Thank you,&lt;BR /&gt;
&lt;BR /&gt;
Ok, and for the surrogate key. Can i generate this in Enterprise Guide when i'm creating a data set ? &lt;BR /&gt;
&lt;BR /&gt;
Do you have some docs on how work a surrogate key in SAS ?&lt;BR /&gt;
&lt;BR /&gt;
thx</description>
      <pubDate>Wed, 05 Aug 2009 12:15:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61442#M6212</guid>
      <dc:creator>DarthSAS</dc:creator>
      <dc:date>2009-08-05T12:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a surrogate key or auto increment ID</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61443#M6213</link>
      <description>I heard a logical explanation for  concern about use of "monotonic()".&lt;BR /&gt;
When an sql platform/optimiser/engine has enough information to multi-thread resolution of a query," monotonic()" may be implemented in parallel across threads. The result would not be what is desired. &lt;BR /&gt;
For simple platforms and queries, that can be expected to single-thread, monotonic() should be able provide the unique id. &lt;BR /&gt;
 &lt;BR /&gt;
This scenario, where a feature cannot be expected to "universally" work, applies in other parts of SAS. For example the number of observations indicated by the NOBS= option on a SET statement, will be missing (or may even be negative) when the data set is a view or subject to a where clause.&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 05 Aug 2009 19:39:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-create-a-surrogate-key-or-auto-increment-ID/m-p/61443#M6213</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-08-05T19:39:44Z</dc:date>
    </item>
  </channel>
</rss>

