i have a large dataset that has a static date on a subject (date of chest CT scan) and i need to find the smallest date difference and keep that row (delete the others). jmp 16.2.0
Example below - i want to keep rows 2 and 4 (the smallest day difference for subject 1 and 2).
subj ID. CT date. lung function date. day difference
Just to extend a little on @WebDesignesCrow interactive solution:
If you don't already have the difference column, you can create it interactively (select both of your dates, right click on the column header and find Difference (reverse order). This will create a new column where the differences are in seconds. If you want to see them in yours/days you can double click on the created column and modify it as needed (such as add division by In Days(1)) but seconds work for this case
jthi_1-1714020133160.png
Then right click on this new column's header and make absolute value column out of it
jthi_5-1714020507585.png
After you have that column, right click on the subjectid column and make it grouping column
jthi_3-1714020241035.png
next you can right click on the date difference column and create rank formula (note the grouping)
jthi_8-1714020609139.png
from the final column, right click on one of the "ones", select matching cells
jthi_7-1714020569347.png
From here you can either create subset using selected rows
jthi_9-1714020648045.png
OR right click on the row list, invert selection and after inversion delete rows
jthi_10-1714020672795.png
jthi_11-1714020685944.png
jthi_12-1714020694899.png
Then if you need to repeat this you can either make a workflow or capture the script from enhanced log
Below is script created by Workflow builder. Only thing it is missing is opening the table as I don't have the table saved (and some column names are incorrect for the same reason) so I added table creation script (workflow is also attached).