<?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 DI Studio: Capture Observations or Locate First Duplicate in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273310#M7626</link>
    <description>&lt;P&gt;Hi Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, using DI Studio I can group columns and create a count(*) coulmn that captures the number in that group, but is there a way to locate the first record in that group?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to find the first time one of the duplicates appears, because I want to keep that one and close out the rest on a fact table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking if I could have a column that had each observation within the group numbered I could simply look for the '1' in this column. Or if I could find another way to flag one record within the group, that'd be great.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems like a simple thing to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2016 15:54:39 GMT</pubDate>
    <dc:creator>jwhite</dc:creator>
    <dc:date>2016-05-26T15:54:39Z</dc:date>
    <item>
      <title>DI Studio: Capture Observations or Locate First Duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273310#M7626</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, using DI Studio I can group columns and create a count(*) coulmn that captures the number in that group, but is there a way to locate the first record in that group?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to find the first time one of the duplicates appears, because I want to keep that one and close out the rest on a fact table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking if I could have a column that had each observation within the group numbered I could simply look for the '1' in this column. Or if I could find another way to flag one record within the group, that'd be great.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems like a simple thing to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 15:54:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273310#M7626</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2016-05-26T15:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio: Capture Observations or Locate First Duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273324#M7629</link>
      <description>&lt;P&gt;I'm not sure how you would apply this logic into a job/flow, and how would the Table Loader step work...?&lt;/P&gt;
&lt;P&gt;Nevertheless, I don't think that a standard transformation could do this in one step.&lt;/P&gt;
&lt;P&gt;If your data is sorted, a User&amp;nbsp;Written code with if first.your_group then counter+1; would do the trick.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 17:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273324#M7629</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-26T17:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio: Capture Observations or Locate First Duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273340#M7634</link>
      <description>&lt;P&gt;Fortunately, I don't need this in a Table Loader step, but for the time being just for some analysis. I was thinking I could do it in an Extract, but maybe I would need to use a User Written piece, and sort the code first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm a SAS beginner, so could you flesh out your suggestion just a bit more?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, Linus!&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 18:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273340#M7634</guid>
      <dc:creator>jwhite</dc:creator>
      <dc:date>2016-05-26T18:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio: Capture Observations or Locate First Duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273344#M7638</link>
      <description>If it's just for analysis DI Studio may not be the ideal environment. Rather Enterprise Guide or SAS Studio. &lt;BR /&gt;Either way, the data step would be something like:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;Set have;&lt;BR /&gt;By myid;&lt;BR /&gt;If first.myid then counter=1;&lt;BR /&gt;Else counter +1;&lt;BR /&gt;Run;</description>
      <pubDate>Thu, 26 May 2016 18:10:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273344#M7638</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-26T18:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio: Capture Observations or Locate First Duplicate</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273374#M7643</link>
      <description>SQL typically isn't a good option for things like the "first" record in a group, UNLESS you can identify it by some combination of min or max of variables, in which case it's usually quite easy.

Provide a few more details about what you need. Personally, I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt; that you should use EG or Studio if it's exploratory.

Tom</description>
      <pubDate>Thu, 26 May 2016 19:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Capture-Observations-or-Locate-First-Duplicate/m-p/273374#M7643</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2016-05-26T19:30:34Z</dc:date>
    </item>
  </channel>
</rss>

