<?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: Data Matching problem in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155664#M40892</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here a sample code. Not been tested for any M-M situations.&lt;/P&gt;&lt;P&gt;In result, you can chose to keep the information of a match on asingle row, or have them on seprate rows (and then, you probably need som id that hold the match together, no?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table step1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select have2.*, have1.user as user2 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from have2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inner join have1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on have2.acct = have1.r_accounts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select A.*, b.acct as acct2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from step1 as a inner join step1 as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.user = b.user2 and a.user2 = b.user and a.user not = b.user&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Jan 2014 16:36:37 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2014-01-29T16:36:37Z</dc:date>
    <item>
      <title>Data Matching problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155663#M40891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;My problem seems like it should be easy, but I can't seen to determine the correct solution.&lt;/P&gt;&lt;P&gt;Each employee has restricted accounts they can not access (have1).&lt;/P&gt;&lt;P&gt;What I want to identify from the logs (have2), are those employees who accessed another employee's restricted account.&amp;nbsp; And the employee whose restricted account was accessed, accessed a restricted account for the employee who accessed their account.&lt;/P&gt;&lt;P&gt;I am trying to identify the scenario where if you access my restricted account, I will access your restricted account to bypass the account control.&lt;/P&gt;&lt;P&gt;The 2 tables are simplified data examples, but the logic for the solution should be the same for my production data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have1;&lt;/P&gt;&lt;P&gt;length User R_Accounts $2;&lt;/P&gt;&lt;P&gt;input User R_Accounts;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;AA A1&lt;/P&gt;&lt;P&gt;AA A2&lt;/P&gt;&lt;P&gt;AA A3&lt;/P&gt;&lt;P&gt;BB B1&lt;/P&gt;&lt;P&gt;BB B2&lt;/P&gt;&lt;P&gt;BB B3&lt;/P&gt;&lt;P&gt;CC C1&lt;/P&gt;&lt;P&gt;CC C2&lt;/P&gt;&lt;P&gt;CC C3&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have2&lt;/P&gt;&lt;P&gt;length user Acct $2;&lt;/P&gt;&lt;P&gt;input id $3 user acct $2 ;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;001 AA B1&lt;/P&gt;&lt;P&gt;002 AA Z2&lt;/P&gt;&lt;P&gt;003 AA Z3&lt;/P&gt;&lt;P&gt;004 BB A1&lt;/P&gt;&lt;P&gt;005 BB Z1&lt;/P&gt;&lt;P&gt;006 BB C2&lt;/P&gt;&lt;P&gt;007 CC B2&lt;/P&gt;&lt;P&gt;008 CC A2&lt;/P&gt;&lt;P&gt;009 CC Z2&lt;/P&gt;&lt;P&gt;010 AA A1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Want&lt;/P&gt;&lt;P&gt; id&amp;nbsp;&amp;nbsp; user&amp;nbsp; acct&lt;/P&gt;&lt;P&gt;001&amp;nbsp; AA&amp;nbsp;&amp;nbsp;&amp;nbsp; B1&lt;/P&gt;&lt;P&gt;004&amp;nbsp; BB&amp;nbsp;&amp;nbsp;&amp;nbsp; A1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;006&amp;nbsp; BB&amp;nbsp;&amp;nbsp;&amp;nbsp; C2&lt;/P&gt;&lt;P&gt;007&amp;nbsp; CC&amp;nbsp;&amp;nbsp;&amp;nbsp; B2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above "Want" results, AA accessed a restricted account of BB, and BB accessed an account for AA.&lt;/P&gt;&lt;P&gt;The same for the second pair, BB accessed an account of CC's and CC accessed an account for BB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 16:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155663#M40891</guid>
      <dc:creator>Frank_K</dc:creator>
      <dc:date>2014-01-29T16:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Data Matching problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155664#M40892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here a sample code. Not been tested for any M-M situations.&lt;/P&gt;&lt;P&gt;In result, you can chose to keep the information of a match on asingle row, or have them on seprate rows (and then, you probably need som id that hold the match together, no?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table step1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select have2.*, have1.user as user2 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from have2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inner join have1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on have2.acct = have1.r_accounts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select A.*, b.acct as acct2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from step1 as a inner join step1 as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.user = b.user2 and a.user2 = b.user and a.user not = b.user&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 16:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155664#M40892</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-01-29T16:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Data Matching problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155665#M40893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you LinusH, this looks like it will work.&amp;nbsp; Yes, your are correct, on my real data I would want the results on a single row,&amp;nbsp; one record.&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2014 17:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-Matching-problem/m-p/155665#M40893</guid>
      <dc:creator>Frank_K</dc:creator>
      <dc:date>2014-01-29T17:49:14Z</dc:date>
    </item>
  </channel>
</rss>

