<?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: key for dual customers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853396#M337307</link>
    <description>&lt;P&gt;It would always help to clarify what you want if you also provide the desired result based on sample data provided.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;The traget- For customers belong to team='b' (3 customers) I want to find the list of "dual customers from team a".&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Assuming what you want I had to change the sample data you provided to then create below report. Is this what you're after?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  Input Customer  ID   team $;
  cards;
111111 1  a
111111 2  b
222222 1  b
333333 4  a
444444 5  b
555555 6  a
777777 8  b
888888 8  a
;

title 'Customers belonging to more than one team';
proc sql;
  select 
    *,
    count(distinct team) as n_teams
  from have
  group by customer
  having count(distinct team)&amp;gt;1
  ;
quit;
title;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1673503260409.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79304i73407D4B4225A4E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1673503260409.png" alt="Patrick_0-1673503260409.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2023 06:01:57 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-01-12T06:01:57Z</dc:date>
    <item>
      <title>key for dual customers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853324#M337265</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;For each customer there is one ID or multiple ID's.&lt;/P&gt;
&lt;P&gt;I would like to create same key for customers that have at least one common ID.&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;Create same key to customers 111111 and 222222&lt;/P&gt;
&lt;P&gt;Create same key to customers 777777 and 888888&lt;/P&gt;
&lt;P&gt;For other customers will create for each customer another key because they dont share any ID.&lt;/P&gt;
&lt;P&gt;What is best way to do it ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
Input Customer  ID ;
 cards;
111111 1 
111111 2 
222222 1
333333 4
444444 5
555555 6
777777 8
888888 8
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 18:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853324#M337265</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-01-11T18:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: key for dual customers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853351#M337275</link>
      <description>&lt;P&gt;You already have such a key, it is the variable ID. No need to create something redundant.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 20:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853351#M337275</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-11T20:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: key for dual customers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853359#M337280</link>
      <description>&lt;P&gt;I will change a bit the question:&lt;/P&gt;
&lt;P&gt;I added also team variable.&lt;/P&gt;
&lt;P&gt;The traget- For customers belong to team='b' (3 customers) I want to find the list of "dual customers from team a".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
Input Customer  ID   team $;
 cards;
111111 1  a
111111 2  a
222222 1  b
333333 4  a
444444 5  b
555555 6  a
777777 8  b
888888 8  a
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Jan 2023 21:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853359#M337280</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-01-11T21:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: key for dual customers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853360#M337281</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The traget- For customers belong to team='b' (3 customers) I want to find the list of "dual customers from team a".&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not sure I understand the question, can you show what the expected result is for your sample data and explain how you got there.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 21:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853360#M337281</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-01-11T21:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: key for dual customers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853396#M337307</link>
      <description>&lt;P&gt;It would always help to clarify what you want if you also provide the desired result based on sample data provided.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;The traget- For customers belong to team='b' (3 customers) I want to find the list of "dual customers from team a".&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Assuming what you want I had to change the sample data you provided to then create below report. Is this what you're after?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  Input Customer  ID   team $;
  cards;
111111 1  a
111111 2  b
222222 1  b
333333 4  a
444444 5  b
555555 6  a
777777 8  b
888888 8  a
;

title 'Customers belonging to more than one team';
proc sql;
  select 
    *,
    count(distinct team) as n_teams
  from have
  group by customer
  having count(distinct team)&amp;gt;1
  ;
quit;
title;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1673503260409.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/79304i73407D4B4225A4E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1673503260409.png" alt="Patrick_0-1673503260409.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 06:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/key-for-dual-customers/m-p/853396#M337307</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-01-12T06:01:57Z</dc:date>
    </item>
  </channel>
</rss>

