<?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 display a certain value from two linked records? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580484#M164904</link>
    <description>&lt;P&gt;Thank you for the above response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I would expect it to look like follows (I have also added how it would look like the for EVENT mentioned at the beginning of this thread):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            ID     NEWID  EVENT                                 AEID    LINKID
      ------------------------------------------------------------------------
           101         7  Rash_maculo-papular                      5         5
           101        12  Rash_maculo-papular                      7         5
           101        15  Rash_maculo-papular                     12         5
           101         .  Rash_maculo-papular                     15         5
           101        19  Rash_maculo-papular                     18        18
           101         .  Rash_maculo-papular                     19        18&lt;BR /&gt;           &lt;BR /&gt;           102         .  Dyspnoea                                 1         2&lt;BR /&gt;           102         1  Dyspnoea                                 2         2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for ID 101 when NEWID = 7 and EVENT = Rash_maculo-papular this is classed as the first occurence of the EVENT within the linked EVENTS - so LINKID is populated with 5 already.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then for ID 101 when NEWID = 19 and EVENT = Rash_maculo-papular this is classed as the first occurence of the EVENT within the linked EVENTS - so LINKID is populated with 18 already.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So then when NEWID = AEID I'd like LINKID to be populated with the LINKID from the first occurence (as shown above)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was done fine in the code I was using, when using a retain function. However, the second example I have given causes problems as I cannot use a retain function on that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ID 102 when NEWID = 1 and EVENT = DYSPNOEA this is classed as the first occurence of the EVENT, so LINKID is populated with 2 already for that observation. So I'm wanting the record above it, where the NEWID = AEID to be populated with the LINKID from the first occurence (which would be 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm hopefully looking for a solution with the outcome of the table above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate the help so far!, it's just a really awkward one to try to explain, so hoping the above can clear it up abit &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Aug 2019 08:30:08 GMT</pubDate>
    <dc:creator>joshCRF</dc:creator>
    <dc:date>2019-08-12T08:30:08Z</dc:date>
    <item>
      <title>How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580387#M164861</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SUBJECT ID&lt;/TD&gt;&lt;TD&gt;NEWID&lt;/TD&gt;&lt;TD&gt;ADVERSE EVENT&lt;/TD&gt;&lt;TD&gt;AEID&lt;/TD&gt;&lt;TD&gt;LINKID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Dyspnoea&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;Dyspnoea&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Dyspnoea&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Struggled to think of a subject topic to correctly describe what I want to occur; so above is a small sample of a data set I am currently working with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know it it's possible that when NEWID is equal to AEID (so the first and second observation) that the missing LINKID is populated with the LINKID where the NEWID is populated. So would be expecting that the missing LINKID would be populated with '2'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the above just show's one ADVERSE EVENT, I need this to be correctly be applied to different ADVERSE EVENTS where the numbers might be the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No code to provide as I am currently racking my brains as to how to get this to work!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 11:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580387#M164861</guid>
      <dc:creator>joshCRF</dc:creator>
      <dc:date>2019-08-11T11:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580388#M164862</link>
      <description>&lt;P&gt;This short example is hard to generalize into something that can be coded, and that correctly answers the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it always the case that NEWID is populated in the record immediately after AEID has the same value, or can the NEWID of 1 be in any record in the data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can there be more than one record for which NEWID matches an AEID?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 11:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580388#M164862</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-11T11:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580389#M164863</link>
      <description>&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;SUBJECT ID&lt;/TD&gt;&lt;TD&gt;NEWID&lt;/TD&gt;&lt;TD&gt;ADVERSE EVENT&lt;/TD&gt;&lt;TD&gt;AEID&lt;/TD&gt;&lt;TD&gt;LINKID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;Rash maculo-papular&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;Rash maculo-papular&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;Rash maculo-papular&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Rash maculo-papular&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;Rash maculo-papular&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;TD&gt;18&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Rash maculo-papular&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&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;So I've added a further example - within a certain ADVERSE EVENT, when the ADVERSE EVENT is linked the NEWID will always match up to AEID, generally it can fall on any record.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see above the LINKID which I want to display on the linked ADVERSE EVENT is the first value of AEID within the linked ADVERSE EVENT, so I was just using the retain function to populate the missing LINKID's&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, as per the example in the first post, the retain function would be retaining a value from a previous (different ADVERSE EVENT) which is giving me incorrect results.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 12:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580389#M164863</guid>
      <dc:creator>joshCRF</dc:creator>
      <dc:date>2019-08-11T12:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580390#M164864</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;So I've added a further example - within a certain ADVERSE EVENT, when the ADVERSE EVENT is linked the NEWID will always match up to AEID, generally it can fall on any record.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you have given us two examples where this is not true, can we have an example where NEWID and AEID are not in consecutive records? Can you please provide the data following &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_self"&gt;these instructions&lt;/A&gt; so that we may write a program that works on your actual sample data?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 12:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580390#M164864</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-11T12:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580403#M164869</link>
      <description>&lt;P&gt;I will have to attach an excel file, due to working off a company laptop the code that has been provided to convert to the dataset to SAS code will not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached excel file, presents all the records in the dataset. Which you should be able to import into SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So... when NEWID is present (for the very first ADVERSE EVENT of a set of linked adverse events) the LINKID will equal the AEID.&lt;/P&gt;&lt;P&gt;The above has already been created in the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then within the same linked adverse events, when NEWID is equal to the AEID, the LINKID needs to equal the LINKID of the first ADVERSE EVENT.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Aug 2019 14:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580403#M164869</guid>
      <dc:creator>joshCRF</dc:creator>
      <dc:date>2019-08-11T14:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580426#M164882</link>
      <description>&lt;P&gt;Some of us will not (or cannot) download Microsoft Office files, as they are a security threat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, to repeat my earlier request:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please provide the data following &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_self"&gt;these instructions&lt;/A&gt; so that we may write a program that works on your actual sample data?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sun, 11 Aug 2019 20:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580426#M164882</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-11T20:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580455#M164896</link>
      <description>&lt;P&gt;It can be done in SAS/SQL with a correlated subquery :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID	NEWID	EVENT :$32.	AEID;
datalines;
101	7	Rash_maculo-papular	5	
101	12	Rash_maculo-papular	7	
101	15	Rash_maculo-papular	12	
101	 .	Rash_maculo-papular	15	
101	19	Rash_maculo-papular	18	
101	 .	Rash_maculo-papular	19	
;

proc sql;
select 
    *,
    case when NEWID in (select AEID from have where ID=a.ID and EVENT=a.EVENT) then AEID
    else . end as LINKID
from have as a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;            ID     NEWID  EVENT                                 AEID    LINKID
      ------------------------------------------------------------------------
           101         7  Rash_maculo-papular                      5         5
           101        12  Rash_maculo-papular                      7         7
           101        15  Rash_maculo-papular                     12        12
           101         .  Rash_maculo-papular                     15         .
           101        19  Rash_maculo-papular                     18        18
           101         .  Rash_maculo-papular                     19         .
&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Aug 2019 04:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580455#M164896</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-08-12T04:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580484#M164904</link>
      <description>&lt;P&gt;Thank you for the above response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I would expect it to look like follows (I have also added how it would look like the for EVENT mentioned at the beginning of this thread):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            ID     NEWID  EVENT                                 AEID    LINKID
      ------------------------------------------------------------------------
           101         7  Rash_maculo-papular                      5         5
           101        12  Rash_maculo-papular                      7         5
           101        15  Rash_maculo-papular                     12         5
           101         .  Rash_maculo-papular                     15         5
           101        19  Rash_maculo-papular                     18        18
           101         .  Rash_maculo-papular                     19        18&lt;BR /&gt;           &lt;BR /&gt;           102         .  Dyspnoea                                 1         2&lt;BR /&gt;           102         1  Dyspnoea                                 2         2&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for ID 101 when NEWID = 7 and EVENT = Rash_maculo-papular this is classed as the first occurence of the EVENT within the linked EVENTS - so LINKID is populated with 5 already.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then for ID 101 when NEWID = 19 and EVENT = Rash_maculo-papular this is classed as the first occurence of the EVENT within the linked EVENTS - so LINKID is populated with 18 already.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So then when NEWID = AEID I'd like LINKID to be populated with the LINKID from the first occurence (as shown above)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was done fine in the code I was using, when using a retain function. However, the second example I have given causes problems as I cannot use a retain function on that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For ID 102 when NEWID = 1 and EVENT = DYSPNOEA this is classed as the first occurence of the EVENT, so LINKID is populated with 2 already for that observation. So I'm wanting the record above it, where the NEWID = AEID to be populated with the LINKID from the first occurence (which would be 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm hopefully looking for a solution with the outcome of the table above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate the help so far!, it's just a really awkward one to try to explain, so hoping the above can clear it up abit &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 08:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580484#M164904</guid>
      <dc:creator>joshCRF</dc:creator>
      <dc:date>2019-08-12T08:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580545#M164926</link>
      <description>&lt;P&gt;It is one to one linked or one to many linked?&lt;/P&gt;
&lt;P&gt;The following could give you a start. Note : the code only suited for ONE id and ONE Event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have(keep=newid aeid rename=(newid=_end aeid=_start));
input ID	NEWID	EVENT :$32.	AEID;
datalines;
101	7	Rash_maculo-papular	5	
101	12	Rash_maculo-papular	7	
101	15	Rash_maculo-papular	12	
101	 .	Rash_maculo-papular	15	
101	19	Rash_maculo-papular	18	
101	 .	Rash_maculo-papular	19	
;

proc sql;
create table ancestor as
select * from have
 where _start not in (select _end from have);
quit;

 

data want(keep=path);
if _n_ eq 1 then do;
length path _path  $ 700 ;
if 0 then set have;
declare hash ha(hashexp:20,dataset:'have(where=(_start is not missing and _end is not missing))',multidata:'y');
ha.definekey('_start');
ha.definedata('_end');
ha.definedone();

declare hash pa(ordered:'y');
declare hiter hi_path('pa');
pa.definekey('n');
pa.definedata('n','path');
pa.definedone();

end;


set ancestor;
count=1;n=1;_n=1;
path=catx('|',_start,_end);
*putlog 'WARNING:Found  ' _end;
   
pa.add();
do while(hi_path.next()=0);
 if n ne 1 then pa.remove(key:_n);_n=n;
 _path=path;   
 _start=scan(path,-1,'|');
 rc=ha.find();   if rc ne 0 then output;
 do while(rc=0);
  if not findw(path,strip(_end),'|') then do;
   if length(path)+length(_end)+1 gt lengthc(path) then do;
    putlog 'ERROR: The length of path and _path are set too short';
    stop;
   end;
   
   *putlog 'WARNING:Found  ' _end;
   count+1;n=count;
   path=catx('|',path,_end);
   pa.add(); *output;
   path=_path;
 end;  
 else output; /* It is a circle.*/
  rc=ha.find_next();
end;
end;
pa.clear();

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2019 13:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/580545#M164926</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-12T13:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/581019#M165098</link>
      <description>&lt;P&gt;Many thanks for all your responses, been a bit busy so only had chance to respond.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I managed to solve my issue with the following set statements:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;data want;&lt;BR /&gt;  set have;&lt;BR /&gt;  set have(firstobs=2 keep=newid aeid linkid rename=(newid=x1 aeid=y1 linkid=z1))&lt;BR /&gt;  set have(obs=1 drop=_all_);&lt;BR /&gt;&lt;BR /&gt;  if x1=aeid then linkid=z1;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for the rash maculo papular events I kept my retain, and then used the above to correct the population of the LINKID when NEWID doesn't run chronologically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Happy to consider this closed now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks alot.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 08:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/581019#M165098</guid>
      <dc:creator>joshCRF</dc:creator>
      <dc:date>2019-08-14T08:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to display a certain value from two linked records?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/581053#M165110</link>
      <description>&lt;P&gt;You didn't answer my question.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It is one to one matched or one to many matched?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;After running my code ,get WANT dataset ,there is variable PATH like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;5|7|12 ......&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The first part 5 is what aeid you want. 7 12 is the linked id with 5 .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Merge it back to your dataset and get you final need.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 11:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-display-a-certain-value-from-two-linked-records/m-p/581053#M165110</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-14T11:12:55Z</dc:date>
    </item>
  </channel>
</rss>

