<?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: Label the first event for each patient in a large dataset in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722330#M90448</link>
    <description>&lt;P&gt;You can accomplish this by&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Select the TX ID column&lt;/LI&gt;
&lt;LI&gt;Go to pull down menu&amp;nbsp; &amp;nbsp; Rows=&amp;gt;Row Selection=&amp;gt;Select Duplicate Rows&lt;/LI&gt;
&lt;LI&gt;Go to the RowState column and right click on one of the selected rows and select&amp;nbsp; &amp;nbsp;"Invert Selection"&lt;/LI&gt;
&lt;LI&gt;In the RowState column, go to one of the rows that was selected after the Inversion, and right click and select&amp;nbsp; &amp;nbsp;Label/UnLabel.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;You will now have selected all first lrows for each different TX ID values.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 18:39:02 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2024-02-06T18:39:02Z</dc:date>
    <item>
      <title>Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722305#M90442</link>
      <description>&lt;P&gt;I have a medical dataset where each row represents an event for a patient. Some patients have only one event, some have multiple events (which are represented by several rows, each with the same "Tx ID" (see picture below), however, I just want to create a column which labels the first event for each patient.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 16:43:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722305#M90442</guid>
      <dc:creator>cjw99</dc:creator>
      <dc:date>2024-02-06T16:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722329#M90447</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/54759"&gt;@cjw99&lt;/a&gt;&amp;nbsp;-&lt;BR /&gt;There are a number of ways to do this. One way that just uses a column formula is to use Col Rank()&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scott_allen_0-1707244125626.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60942i73826598EE51C5D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scott_allen_0-1707244125626.png" alt="scott_allen_0-1707244125626.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This ranks the date (earliest is lowest rank) by the ID and checks if it is 1 ( returning 1 or 0 ).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a similar data table, you will get this output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scott_allen_1-1707244239691.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60943i2ED724B4B2DDCED0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scott_allen_1-1707244239691.png" alt="scott_allen_1-1707244239691.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The nice thing about Col Rank is that you don't have to have your data table sorted, it will work if you jumble the rows.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 18:35:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722329#M90447</guid>
      <dc:creator>scott_allen</dc:creator>
      <dc:date>2024-02-06T18:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722330#M90448</link>
      <description>&lt;P&gt;You can accomplish this by&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Select the TX ID column&lt;/LI&gt;
&lt;LI&gt;Go to pull down menu&amp;nbsp; &amp;nbsp; Rows=&amp;gt;Row Selection=&amp;gt;Select Duplicate Rows&lt;/LI&gt;
&lt;LI&gt;Go to the RowState column and right click on one of the selected rows and select&amp;nbsp; &amp;nbsp;"Invert Selection"&lt;/LI&gt;
&lt;LI&gt;In the RowState column, go to one of the rows that was selected after the Inversion, and right click and select&amp;nbsp; &amp;nbsp;Label/UnLabel.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;You will now have selected all first lrows for each different TX ID values.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 18:39:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722330#M90448</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-02-06T18:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722333#M90451</link>
      <description>&lt;P&gt;Thank You! I knew there must be a simple way to do this&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 19:51:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722333#M90451</guid>
      <dc:creator>cjw99</dc:creator>
      <dc:date>2024-02-06T19:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722334#M90452</link>
      <description>&lt;P&gt;Thank you.... I never noticed the select duplicate rows option before!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 19:52:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722334#M90452</guid>
      <dc:creator>cjw99</dc:creator>
      <dc:date>2024-02-06T19:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722338#M90454</link>
      <description>&lt;P&gt;I don't want to abuse this service, but is there a way to use this function AND specify the rows ranked that meet a second condition from another column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example....in my dataset, the dates are biopsy dates. Some of these dates are associated with an outcome of interest (kidney transplant rejection) while others are not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to be able to do is rank all the rows in order if they meet the rejection condition while skipping the other rows.&lt;/P&gt;&lt;P&gt;In the end, I would have a column that has labelled the 1st rejection, 2nd rejection, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example...like below. In this data "Bx Date" = biopsy date, and "TCMR Sequence" refers to T cell-mediated rejection.&lt;/P&gt;&lt;P&gt;Here I have already put them all in sequence in the TCMR sequence column but ideally, I would like to generate a formula that does this automatically for all 3,700 rows in the database.&lt;/P&gt;&lt;P&gt;I am familiar with creating simple If/Then formulas but I always struggle once the formula has to evaluate multiple rows for a given patient.&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="cjw99_0-1707250615073.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60944i444DF5629C808D28/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cjw99_0-1707250615073.png" alt="cjw99_0-1707250615073.png" /&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>Tue, 06 Feb 2024 20:22:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722338#M90454</guid>
      <dc:creator>cjw99</dc:creator>
      <dc:date>2024-02-06T20:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722340#M90455</link>
      <description>&lt;P&gt;In addition to what I wrote a moment ago....perhaps this data table makes more sense where a rejection yes/no column is present&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="cjw99_1-1707251240046.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60945i156ED849F831D660/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cjw99_1-1707251240046.png" alt="cjw99_1-1707251240046.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 20:27:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722340#M90455</guid>
      <dc:creator>cjw99</dc:creator>
      <dc:date>2024-02-06T20:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Label the first event for each patient in a large dataset</title>
      <link>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722849#M90512</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/54759"&gt;@cjw99&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one way to create your second table with two column formulas (or one slightly more complicated formula), however, it requires you to sort the data table. If the data table is in the order you display, this will work. If not, first sort the data table by Bx Date - Ascending, then TX ID - Ascending&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Number of Rejections column tracks the number of rejections by TX ID&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scott_allen_0-1707397855235.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60986i9AAC4FE547B7342B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scott_allen_0-1707397855235.png" alt="scott_allen_0-1707397855235.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Final Formula column uses Number of Rejections to piece together an output similar to your target.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scott_allen_1-1707397922432.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60987i8A5395D442E54333/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scott_allen_1-1707397922432.png" alt="scott_allen_1-1707397922432.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can combine the two columns into one, however, my preference is to keep them separate in case you need to make modifications later. You can always hide the intermediate column if you don't want to see it.&lt;/P&gt;
&lt;P&gt;Combined Column&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="scott_allen_2-1707398128460.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60988i30A46AB80FD526B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scott_allen_2-1707398128460.png" alt="scott_allen_2-1707398128460.png" /&gt;&lt;/span&gt;&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="scott_allen_3-1707398285335.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/60989iF172FED83BF1757C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="scott_allen_3-1707398285335.png" alt="scott_allen_3-1707398285335.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the text to match your TCMR Sequence column exactly, you can use a Value Label in the final column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure there are other ways to get to your target column, but this was the first that came to mind using only column formulas.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 13:23:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Label-the-first-event-for-each-patient-in-a-large-dataset/m-p/722849#M90512</guid>
      <dc:creator>scott_allen</dc:creator>
      <dc:date>2024-02-08T13:23:49Z</dc:date>
    </item>
  </channel>
</rss>

