<?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: Return a uinque value after join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817960#M322854</link>
    <description>&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;Caution to anyone copying code from this thread.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;The following lines that appear with curly or "smart" quotes are likely not going to work in your SAS session editor for programming:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;       Team_C =””;

      J_DT =”.”;

      J_ID = “”;

   end;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;In the editor you should see:&lt;/P&gt;
&lt;PRE&gt;Team_C = "";
J_DT   = ".";
J_ID   = "";&lt;/PRE&gt;
&lt;P&gt;or with simple ' type single quotes.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2022 21:43:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-06-13T21:43:18Z</dc:date>
    <item>
      <title>Return a uinque value after join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817678#M322752</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have two tables which has many-to-many relationships with this TEAM_1 and TEAM_2:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.4pt; width: 48pt;"&gt;TEAM_1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;TEAM_2&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;TEAM_C&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;J_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;J_ID&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;JOB3&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;14-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;J3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;JOB4&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;14-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;J4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 384pt;" border="0" width="512" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.4pt; width: 48pt;"&gt;TEAM_1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;TEAM_2&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;A_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;A_ID&lt;/TD&gt;
&lt;TD width="64" class="xl66" style="border-left: none; width: 48pt;"&gt;B_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;B_ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;D_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;D_ID&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;02-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A2&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;03-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;05-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;A3&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to show the after join they only return unique J_DT, J_ID as follow:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 528pt;" border="0" width="704" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.4pt; width: 48pt;"&gt;TEAM_1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;TEAM_2&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;A_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;A_ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;B_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;B_ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;D_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;D_ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;TEAM_C&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;J_DT&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;J_ID&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;02-01-22&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;A2&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;03-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;JOB3&lt;/TD&gt;
&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;14-01-22&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;J3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;05-01-22&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;A3&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;02-01-22&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;A2&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;03-01-22&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;B1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;JOB4&lt;/TD&gt;
&lt;TD class="xl68" style="border-top: none; border-left: none;"&gt;14-01-22&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;J4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.4pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.4pt; border-top: none;"&gt;CINDY&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;BOB&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;05-01-22&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;A3&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;.&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl66" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did the left join and come out wrong output like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sarahzhou_0-1655050531323.png" style="width: 647px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72164i2737038B078EA0C7/image-dimensions/647x296?v=v2" width="647" height="296" role="button" title="sarahzhou_0-1655050531323.png" alt="sarahzhou_0-1655050531323.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my working code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input TEAM_1 $ TEAM_2 $ EVENT_NM $ EVENT_DT :mmddyy. EVENT_ID $ ;
  format event_dt yymmdd10.;
cards;
ALICE  JIMMY  A  1-1-2022 A1
CINDY  BOB  A  1-2-2022 A2
CINDY  BOB  B  1-3-2022 B1
CINDY  BOB  A  1-5-2022 A3
ELLA  JACK  B  1-8-2022 B4
ELLA  JACK  D  1-9-2022 D1 
AMBER  DANIEL  E  1-10-2022 E1
KITTY  ARRON  F  1-11-2022 F1
;


data GOT;
  input TEAM_1 $ TEAM_2 $ TEAM_C $ J_DT :mmddyy. J_ID $ ;
  format J_DT yymmdd10.;
cards;
ALICE  JIMMY  JOB1  1-12-2022 J1
ALICE  JIMMY  JOB2  1-13-2022 J2
CINDY  BOB  JOB3  1-14-2022 J3
CINDY  BOB  JOB4  1-14-2022 J4
AMBER  DANIEL  JOB5  1-16-2022 J5
AMBER  DANIEL  JOB6  1-17-2022 J6
KITTY  ARRON  JOB7  1-18-2022 J7
;

data groups1;
  set have;
  by team_1 team_2 notsorted ;
  group + (EVENT_NM &amp;lt;= lag(EVENT_NM) );
  if first.team_2 then group=1;
run;
proc transpose data=groups1 out=wide1(DROP=_NAME_);
  by team_1 team_2 group group notsorted;
  id  EVENT_NM ;
  var EVENT_ID;
run;
proc print data=wide1;
run;

data groups2;
  set have;
  by team_1 team_2 notsorted ;
  group + (EVENT_NM &amp;lt;= lag(EVENT_NM) );
  if first.team_2 then group=1;
run;
proc transpose data=groups2 out=wide2(DROP=_NAME_);
  by team_1 team_2 group group notsorted;
  id  EVENT_NM;
  var EVENT_dt;
run;
proc print data=wide2;
run;

PROC SQL;
CREATE TABLE EVENT_DT AS
SELECT 
TEAM_1,
TEAM_2,
GROUP,
A AS A_DT,
B AS B_DT,
/*C AS C_DT,*/
D AS D_DT
/*E AS E_DT,*/
/*F AS F_DT*/
FROM WIDE2;
QUIT;

PROC SQL;
CREATE TABLE EVENT_ID AS
SELECT 
TEAM_1,
TEAM_2,
GROUP,
A AS A_ID,
B AS B_ID,
/*C AS C_ID,*/
D AS D_ID
/*E AS E_ID,*/
/*F AS F_ID*/
FROM WIDE1;
QUIT;
 
PROC SQL;
CREATE TABLE ID_DT AS
SELECT 
A.TEAM_1,
A.TEAM_2,

B.A_DT,
A.A_ID,

B.B_DT,
A.B_ID,

/*B.C_DT,*/
/*A.C_ID,*/

B.D_DT,
A.D_ID

/*B.E_DT,*/
/*A.E_ID,*/
/**/
/*B.F_DT,*/
/*A.F_ID*/
 

FROM EVENT_ID A FULL OUTER JOIN EVENT_DT B
ON A.TEAM_1=B.TEAM_1 AND A.TEAM_2 = B.TEAM_2 and A.GROUP=B.GROUP;
QUIT;

PROC SQL;
CREATE TABLE ID_DT_JOB AS
SELECT DISTINCT * FROM ID_DT A
LEFT JOIN GOT B
ON A.TEAM_1=B.TEAM_1 AND A.TEAM_2 = B.TEAM_2
ORDER BY B.J_DT;
QUIT;


PROC SQL;
CREATE TABLE ID_DT_JOBt_DST AS
SELECT DISTINCT
A.TEAM_1,
A.TEAM_2,
B.TEAM_C
FROM ID_DT A
LEFT JOIN GOT B
ON A.TEAM_1=B.TEAM_1 AND A.TEAM_2 = B.TEAM_2;
QUIT; 


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How can I fix this?&lt;/P&gt;
&lt;P&gt;Appriciate your help!&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 16:18:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817678#M322752</guid>
      <dc:creator>sarahzhou</dc:creator>
      <dc:date>2022-06-12T16:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Return a uinque value after join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817724#M322762</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/402346"&gt;@sarahzhou&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;just to better understand what you are aming for:&lt;/P&gt;
&lt;P&gt;If you&lt;/P&gt;
&lt;P&gt;1. sorted your current output table by J_ID and A_ID&lt;/P&gt;
&lt;P&gt;2. grouped by J_ID&lt;/P&gt;
&lt;P&gt;3. set Team_C, J_DT and J_ID to missing, if it is not the first row of the group&lt;/P&gt;
&lt;P&gt;Would you then have what you want?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 08:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817724#M322762</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-06-13T08:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Return a uinque value after join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817814#M322812</link>
      <description>&lt;P&gt;3. set Team_C, J_DT and J_ID to missing, if it is not the first row of the group&lt;/P&gt;
&lt;P&gt;Would you then have what you want?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, that can work. How can I set missing "if it is not the first row of the group"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SQL;
CREATE TABLE ID_DT_JOB AS
SELECT DISTINCT * FROM ID_DT A
LEFT JOIN GOT B
ON A.TEAM_1=B.TEAM_1 AND A.TEAM_2 = B.TEAM_2
ORDER BY B.TEAM_C;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 14:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817814#M322812</guid>
      <dc:creator>sarahzhou</dc:creator>
      <dc:date>2022-06-13T14:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Return a uinque value after join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817822#M322817</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/402346"&gt;@sarahzhou&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;after sorting the data, you might apply a datastep with the FIRST. variable (&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lepg/p181g1p4bw3phkn1vt5p67xvynd5.htm" target="_blank"&gt;FIRST. and LAST. DATA Step Variables&lt;/A&gt;), something like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data wanted_list;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;set ID_DT_JOB;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;by J_ID;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if not first.dept then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; do&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;Team_C =””;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;J_DT =”.”;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;J_ID = “”;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(I haven't tested it, but it shows the principle).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;
&lt;P&gt;Markus&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 15:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817822#M322817</guid>
      <dc:creator>MarkusWeick</dc:creator>
      <dc:date>2022-06-13T15:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Return a uinque value after join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817823#M322818</link>
      <description>&lt;P&gt;It worked! Thx&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/401244"&gt;@MarkusWeick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wanted_list;

set ID_DT_JOB;

by J_ID;

if not first.dept then

   do

       Team_C =””;

      J_DT =”.”;

      J_ID = “”;

   end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2022 15:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817823#M322818</guid>
      <dc:creator>sarahzhou</dc:creator>
      <dc:date>2022-06-13T15:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Return a uinque value after join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817960#M322854</link>
      <description>&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;Caution to anyone copying code from this thread.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#FF6600"&gt;&lt;STRONG&gt;The following lines that appear with curly or "smart" quotes are likely not going to work in your SAS session editor for programming:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;       Team_C =””;

      J_DT =”.”;

      J_ID = “”;

   end;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;In the editor you should see:&lt;/P&gt;
&lt;PRE&gt;Team_C = "";
J_DT   = ".";
J_ID   = "";&lt;/PRE&gt;
&lt;P&gt;or with simple ' type single quotes.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2022 21:43:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Return-a-uinque-value-after-join/m-p/817960#M322854</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-13T21:43:18Z</dc:date>
    </item>
  </channel>
</rss>

