<?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: AE Programming query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910082#M358941</link>
    <description>&lt;P&gt;it seems you want it within ae too, so then just change to if first.ae as such.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tarheel13_0-1704203891007.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92164i2F7B94F96731005E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tarheel13_0-1704203891007.png" alt="tarheel13_0-1704203891007.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set test;
   by usubjid ae;
   length rank 8 maxrank 8;
   retain rank;

   if _n_=1 then do;
      declare hash end ();
      end.definekey("aendt", "llt");
      end.definedata("rank");
      end.definedone();
   end;

   if first.ae then do;
      rc=end.clear();
      maxrank=1;
      rank=1;
      rc=end.add();
   end;
   else do;

      if end.find(key:astdt, key:llt) ne 0 then
         do;
            maxrank + 1;
            rank=maxrank;
            rc=end.add();
         end;
      else do;

            if end.check() ne 0 then
               rc=end.add();
         end;
   end;
drop rc maxrank;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Jan 2024 13:58:19 GMT</pubDate>
    <dc:creator>tarheel13</dc:creator>
    <dc:date>2024-01-02T13:58:19Z</dc:date>
    <item>
      <title>AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910010#M358905</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;I need to create RANK variable in the dataset shown below (for each USUBJID and AE).&lt;/P&gt;
&lt;P&gt;The input variables are USUBJID, ASTDT, AENDT, AE, LLT.&lt;/P&gt;
&lt;P&gt;dataset sorted by USUBJID , AE , ASTDT and AENDT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if the AENDT and LLT of the prior AE is not the ASTDT and LLT of the next AE, then we need to create RANK as +1.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If the ASTDT and LLT of the next AE is the AENDT and LLT of the previous AE record then RANK remains the same.&amp;nbsp;(that is why we have RANK= 1 for obs. no. 2, as the 06MAR2020 is the AENDT and Lipa is the LLT for obs. no. 1)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;If the ASTDT and LLT of the next AE is the AENDT and LLT of the any previous AE record then RANK remains the same.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;so in case of obs. no. 6. ASTDT =21MAY2020 and LLT = Lipa is the AENDT and LLT of 4th obs.&amp;nbsp; so the RANK value will be the whatever value is from 4th obs. in this case obs. no . 4 RANK=3 so it will be same for obs. no. 6.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could you please help me program this?&lt;/P&gt;
&lt;P&gt;I am also attaching the datalines for this dataset for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_0-1704126293067.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92145iB613B1D5ED2D56A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhinayingole_0-1704126293067.png" alt="abhinayingole_0-1704126293067.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
informat astdt date9. aendt date9.;
input @1 usubjid $3.
      @5 ae $7.
      @13 llt $7.
      @21 astdt date9.
      @33 aendt date9.
      @45 Rank 1.
;

format astdt aendt date9.;

datalines;
120	enzymes	Lipa    21FEB2020   06MAR2020   1
120	enzymes	Lipa    06MAR2020   13MAR2020   1
120	enzymes	Serum   06MAR2020   13MAR2020   2
120	enzymes	Lipa    09APR2020   21MAY2020   3
120	enzymes	Serum   09APR2020   03JUN2020   4
120	enzymes	Lipa    21MAY2020   01JUL2020   3
120	enzymes	Serum   03JUN2020   01JUL2020   4
120	enzymes	Lipa    01JUL2020   28JUL2020   3
120	enzymes	Serum   01JUL2020   18NOV2020   4
120	enzymes	Lipa    28JUL2020   26AUG2020   3
120	enzymes	Lipa    26AUG2020   21OCT2020   3
120	enzymes	Lipa    18NOV2020   15DEC2020   6
120	enzymes	Amylase 18NOV2020   15DEC2020   5
120	enzymes	Serum   15DEC2020   .           7
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Jan 2024 16:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910010#M358905</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-01T16:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910012#M358906</link>
      <description>&lt;P&gt;you could possibly try the lag function to store the previous end date and previous LLT in new variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jan 2024 17:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910012#M358906</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-01T17:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910013#M358907</link>
      <description>&lt;P&gt;Looks like you can use my hash code from your other thread, with only usubjid and ae as group, and llt as an additional key in the hash. Give it a try.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jan 2024 18:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910013#M358907</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-01T18:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910014#M358908</link>
      <description>&lt;PRE&gt;data test;
informat usubjid $3. llt $5. ae $7. astdt date9. aendt date9.;
input usubjid $
      ae $
      llt $
      astdt 
      aendt
;

format astdt aendt date9.;

datalines;
120   enzymes  Lipa    21FEB2020   06MAR2020   
120   enzymes  Lipa    06MAR2020   13MAR2020   
120   enzymes  Serum   06MAR2020   13MAR2020   
120   enzymes  Lipa    09APR2020   21MAY2020   
120   enzymes  Serum   09APR2020   03JUN2020   
120   enzymes  Lipa    21MAY2020   01JUL2020   
120   enzymes  Serum   03JUN2020   01JUL2020   
120   enzymes  Lipa    01JUL2020   28JUL2020   
120   enzymes  Serum   01JUL2020   18NOV2020   
120   enzymes  Lipa    28JUL2020   26AUG2020   
120   enzymes  Lipa    26AUG2020   21OCT2020   
120   enzymes  Lipa    18NOV2020   15DEC2020   
120   enzymes  Amylase 18NOV2020   15DEC2020   
120   enzymes  Serum   15DEC2020   .           
;
proc print;
run;


data want;
set test;
by usubjid ae;
length rank 8 maxrank 8;
retain rank;
if _n_ = 1
then do;
  declare hash end ();
  end.definekey("aendt","llt");
  end.definedata("rank");
  end.definedone();
end;
if first.usubjid then rank = 1;
else do;
  if first.rank
  then do;
    rc = end.clear();
    maxrank = 1;
    rank = 1;
    rc = end.add();
  end;
  else do;
    if end.find(key:astdt,key:llt) ne 0
    then do;
      maxrank + 1;
      rank = maxrank;
      rc = end.add();
    end;
    else do;
      if end.check() ne 0
      then rc = end.add();
    end;
  end;
end;
drop rc maxrank;
proc print;
run;
&lt;/PRE&gt;
&lt;P&gt;Adapting&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;'s code. shouldn't the last 3 rows be 5,6,7 for rank and not 6,5,7?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jan 2024 19:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910014#M358908</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-01T19:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910022#M358911</link>
      <description>&lt;P&gt;If you allow data to be sorted by&amp;nbsp;usubjid, llt, astdt. it would be much easier.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=test;
  by usubjid ae llt astdt;
run;

data want;
  set test;
  by usubjid ae llt astdt;

  lag_aendt=lag(aendt);
  if first.usubjid then new_rank=1;
  else do;
    if first.llt then new_rank+1;
    else if astdt^=lag_aendt then new_rank+1;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92149iE6148919FC386692/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 03:04:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910022#M358911</guid>
      <dc:creator>whymath</dc:creator>
      <dc:date>2024-01-02T03:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910028#M358913</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181158"&gt;@tarheel13&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, last 3 row should be as 5,6,7. I just need to sort it by LLT.&lt;/P&gt;
&lt;P&gt;Thank you and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;for the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Abhinay&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 05:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910028#M358913</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-02T05:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910034#M358916</link>
      <description>&lt;P&gt;this does not match the desired output OP posted though&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 08:10:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910034#M358916</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-02T08:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910042#M358919</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181158"&gt;@tarheel13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting NOTE in sas log as....&lt;/P&gt;
&lt;P&gt;NOTE: Variable first.rank is uninitialized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do you suggest anything to avoid this as I don't want any uninitialized NOTE in my log.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 10:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910042#M358919</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-02T10:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910043#M358920</link>
      <description>&lt;P&gt;Replace first.rank with first.usubjid.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 10:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910043#M358920</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-01-02T10:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910057#M358927</link>
      <description>&lt;P&gt;try this. no uninitialized in log now.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set test;
   by usubjid ae;
   length rank 8 maxrank 8;
   retain rank;

   if _n_=1 then do;
      declare hash end ();
      end.definekey("aendt", "llt");
      end.definedata("rank");
      end.definedone();
   end;

   if first.usubjid then do;
      rc=end.clear();
      maxrank=1;
      rank=1;
      rc=end.add();
   end;
   else do;

      if end.find(key:astdt, key:llt) ne 0 then
         do;
            maxrank + 1;
            rank=maxrank;
            rc=end.add();
         end;
      else do;

            if end.check() ne 0 then
               rc=end.add();
         end;
   end;
drop rc maxrank;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jan 2024 12:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910057#M358927</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-02T12:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910078#M358939</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181158"&gt;@tarheel13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this code not working if AE changes for same USUBJID.&lt;/P&gt;
&lt;P&gt;could you please suggest.&lt;/P&gt;
&lt;P&gt;I have added the 2 more obs. in the data.&lt;/P&gt;
&lt;P&gt;RANK value for last 2 obs. should be 1 and 2 as AE changes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_0-1704203102211.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92162i3B6B886073982579/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhinayingole_0-1704203102211.png" alt="abhinayingole_0-1704203102211.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
informat astdt date9. aendt date9.;
input @1 usubjid $3.
      @5 ae $7.
      @13 llt $7.
      @21 astdt date9.
      @33 aendt date9.
;

format astdt aendt date9.;

datalines;
120	enzymes	Lipa    21FEB2020   06MAR2020
120	enzymes	Lipa    06MAR2020   13MAR2020
120	enzymes	Serum   06MAR2020   13MAR2020
120	enzymes	Lipa    09APR2020   21MAY2020
120	enzymes	Serum   09APR2020   03JUN2020
120	enzymes	Lipa    21MAY2020   01JUL2020
120	enzymes	Serum   03JUN2020   01JUL2020
120	enzymes	Lipa    01JUL2020   28JUL2020
120	enzymes	Serum   01JUL2020   18NOV2020
120	enzymes	Lipa    28JUL2020   26AUG2020
120	enzymes	Lipa    26AUG2020   21OCT2020
120	enzymes	Lipa    18NOV2020   15DEC2020
120	enzymes	Amylase 18NOV2020   15DEC2020
120	enzymes	Serum   15DEC2020   .    
120 trans   vax     09APR2020   10APR2020
120 trans   vax     12APR2020   13APR2020
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910078#M358939</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-02T13:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910080#M358940</link>
      <description>&lt;P&gt;it seems like you are changing the requirements. you were only considering LLT and AE start and end dates previously. so what is the requirement now?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:53:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910080#M358940</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-02T13:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910082#M358941</link>
      <description>&lt;P&gt;it seems you want it within ae too, so then just change to if first.ae as such.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tarheel13_0-1704203891007.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92164i2F7B94F96731005E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tarheel13_0-1704203891007.png" alt="tarheel13_0-1704203891007.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set test;
   by usubjid ae;
   length rank 8 maxrank 8;
   retain rank;

   if _n_=1 then do;
      declare hash end ();
      end.definekey("aendt", "llt");
      end.definedata("rank");
      end.definedone();
   end;

   if first.ae then do;
      rc=end.clear();
      maxrank=1;
      rank=1;
      rc=end.add();
   end;
   else do;

      if end.find(key:astdt, key:llt) ne 0 then
         do;
            maxrank + 1;
            rank=maxrank;
            rc=end.add();
         end;
      else do;

            if end.check() ne 0 then
               rc=end.add();
         end;
   end;
drop rc maxrank;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jan 2024 13:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910082#M358941</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-02T13:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910083#M358942</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181158"&gt;@tarheel13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am very sorry for any confusion.&lt;/P&gt;
&lt;P&gt;I have mention in the first thread as....&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I need to create RANK variable in the dataset shown below (&lt;STRONG&gt;for each USUBJID and AE&lt;/STRONG&gt;).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So the RANK variable start from 1 if either USUBJID or AE changes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;again sorry for the confusion.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 14:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910083#M358942</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-02T14:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910084#M358943</link>
      <description>&lt;P&gt;no worries. I gave you new code. Please see if the new screenshot matches your desired output. I did not understand your requirement initially. Apologies.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 14:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910084#M358943</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-02T14:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910085#M358944</link>
      <description>&lt;P&gt;Perfect.... thank you very much&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181158"&gt;@tarheel13&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;please don't mind if I bother you again incase I stuck up &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 14:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910085#M358944</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-02T14:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910088#M358946</link>
      <description>&lt;P&gt;haha it's never a bother! I learn so much on this forum!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 14:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910088#M358946</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-02T14:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910089#M358947</link>
      <description>&lt;P&gt;Can you explain WHAT is the medical significance of this calculation?&amp;nbsp; What are you trying to "count" or "rank"?&amp;nbsp; Are you trying to collapse the conflicting date ranges into a single contiguous range?&amp;nbsp; Are you trying to collapse multiple different reported terms into a single record based on the coded Lowest Level Term from the MEDDRA vocabulary?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really need all of the records back out? Or would it be better to just collapse them?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;How did you collect this data?&amp;nbsp; Why do you have overlapping AE dates for the same AE term?&amp;nbsp; Are you sure that all events with overlapping dates can/should be collapsed?&amp;nbsp; What if they got stung by two different bees?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Normally when you collect adverse events from patients (or their doctors) you get a start date and either an end date or an indication that the AE is ongoing.&amp;nbsp; Do you have the ONGOING flag for the individual records?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you collected the data some other way (examining records or billing data perhaps?) then it is more likely you will multiple reports of the same event with conflicting or date ranges that need to be consolidated.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 15:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/910089#M358947</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-02T15:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/911278#M359348</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181158"&gt;@tarheel13&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;My supervisor has another&amp;nbsp;bizarre request with RANK value in this data &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is how we develop RANK value up till now. but my client need highlighted value for obs. 7 and 8 as &lt;FONT color="#00FF00"&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/FONT&gt; and not&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; 1&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_0-1704984753321.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92452i79871065304B551A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhinayingole_0-1704984753321.png" alt="abhinayingole_0-1704984753321.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;like this...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhinayingole_1-1704985059725.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92453iA215A0E4DD01B706/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhinayingole_1-1704985059725.png" alt="abhinayingole_1-1704985059725.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Reason&lt;/STRONG&gt;: He says...while deriving&amp;nbsp; RANK value for obs. 7, he wanted to check latest of&amp;nbsp;&lt;STRONG&gt;LLT = urea&lt;/STRONG&gt; value, which is obs. no. 4 and AENDT of obs. no. 4 is not equal to ASTDT of obs. no. 7, so we need to keep adding RANK +1.&lt;/P&gt;
&lt;P&gt;currently while deriving&amp;nbsp; RANK value for obs. 7, we are considering obs. no. 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can we modify our existing code for this requirement.&lt;/P&gt;
&lt;P&gt;sorry to trouble you with this again.&lt;/P&gt;
&lt;P&gt;I am also attaching the datalines for this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data test;
 
input @1 usubjid $3.
      @5 ae $8.
      @14 llt $8.
      @23 astdt date9.
      @33 aendt date9.
;

format astdt aendt date9.;

datalines;
410	amino    alan     19JUL2022	08AUG2022
410	amino    aspar    01AUG2022	08AUG2022
410	Toxicity urea     26JUL2022	18AUG2022
410	Toxicity urea     02AUG2022	15AUG2022
410	Toxicity prot     08AUG2022	21SEP2022
410	Toxicity creat    11AUG2022	22AUG2022
410	Toxicity urea     18AUG2022	18AUG2022
410	Toxicity urea     18AUG2022	02SEP2022
410	Toxicity minuria  29AUG2022	21SEP2022
410	Toxicity urea dec 15SEP2022	21SEP2022
720	Toxicity estim    27DEC2022	17JAN2023
720	Toxicity urea     03JAN2023	17JAN2023
720	Toxicity creat    10JAN2023	24JAN2023
720	Toxicity estim    17JAN2023	28FEB2023
720	Toxicity urea     31JAN2023	14FEB2023
720	Toxicity creat    31JAN2023	14FEB2023
720	Toxicity urea     21FEB2023	28FEB2023
720	Toxicity estim    28FEB2023	21MAR2023 
;
 
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 15:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/911278#M359348</guid>
      <dc:creator>abhinayingole</dc:creator>
      <dc:date>2024-01-11T15:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: AE Programming query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/911331#M359373</link>
      <description>&lt;P&gt;sorry I don't know how to do that. I would suggest maybe making a new thread with the new requirement. since a solution was already accepted on this thread, there is no chance for another SAS user to have their solution accepted. I think&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;probably knows hash object better than me anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 00:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AE-Programming-query/m-p/911331#M359373</guid>
      <dc:creator>tarheel13</dc:creator>
      <dc:date>2024-01-12T00:54:02Z</dc:date>
    </item>
  </channel>
</rss>

