Por lo tanto, tengo filas para cada fecha de visita clínica. En este momento, todas las fechas de visita a la clínica se registran en la misma columna en "DateSeen". En su lugar, necesito una fila individual para cada ID de paciente y debo crear una columna separada para cada visita (cronológica). Por ejemplo, "primera visita, segunda visita, tercera visita", etc. hasta la quinta visita.
¿Alguien puede ayudar? Por razones obvias, no puedo compartir los datos reales, pero aquí hay algunos datos ficticios.
| CARNÉ DE IDENTIDAD | DateSeen |
| 8 | 5/3/2016 |
| 8 | 20/20/2015 |
| 1 | 12/3/2013 |
| 10 | 28/02/2012 |
| 9 | 13/09/2013 |
| 9 | 23/08/2014 |
| 6 | 7/10/2008 |
| 3 | 1/1/2014 |
| 2 | 15/06/2011 |
| 5 | 01/04/2011 |
| 1 | 26/2/2014 |
| 3 | 30/04/2016 |
| 1 | 8/6/2015 |
| 9 | 5/9/2009 |
| 4 | 01/10/2011 |
| 2 | 23/7/2011 |
| 8 | 5/5/2013 |
| 8 | 10/01/2009 |
| 1 | 11/11/2016 |
| 9 | 6/6/2015 |
| 7 | 20/20/2014 |
| 3 | 21/11/2015 |
| 2 | 3/1/2014 |
| 9 | 8/8/2010 |
| 6 | 01/08/2015 |
| 3 | 8/6/2016 |
| 3 | 9/11/2013 |
| 4 | 27/08/2011 |
| 1 | 7/11/2014 |
| 10 | 31/10/2009 |
| 2 | 01/04/2015 |
| 2 | 11/11/2007 |
| 5 | 18/7/2014 |
| 9 | 15/10/2013 |
Aparentemente causé un poco de confusión. En el script que incluí, incluí un paso que crea la tabla de datos que incluyó en su primera declaración. Esa parte de mi código fue solo para hacer que lo que respondí sea capaz de ejecutarse con algunos datos de muestra. La parte del script que realmente hace el trabajo puede ejecutarse con un número ilimitado de pacientes. Así que todo lo que necesita hacer es crear la tabla de datos de gran tamaño y ejecutar la última parte del script que creé. Solo asegúrese de que la columna de ID del paciente se llame "ID" y la columna de la fecha se llame "Fecha / Visto". Además, la columna "Fecha / Visto" debe ser una columna de fecha JMP numérica.
// Sort the table so that all visits for a given individual are together
// and in asscending order of the visit date
dt << Sort( By( :ID, :Name( "Date/Seen" ) ), Order( Ascending, Ascending ), Replace table( 1 ) );
// Create a new column which is just a simple counter of the visit number
dt << New Column( "Visit Number",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
If( Lag( :ID ) != :ID,
num = 1,
num = num + 1
);
num;
)
);
// Split the data by the visit number
dt << Split(
Split By( :Visit Number ),
Split( :Name( "Date/Seen" ) ),
Group( :ID ),
Sort by Column Property
);
¡¡Eres fabuloso!! Muchas gracias! ¡Esto me estaba estresando! Espero que obtenga una actualización gratuita a primera clase en su próximo vuelo. 
Aquí hay un script simple que hace lo que quieres. Si sigue los pasos del script, es fácil hacer estas 3 operaciones de manera interactiva
Names default to here( 1 );
// Input the original data table
dt = New Table( "Patient Visits",
Add Rows( 34 ),
New Column( "ID",
Character,
"Nominal",
Set Values(
{"8", "8", "1", "10", "9", "9", "6", "3", "2", "5", "1", "3", "1", "9", "4", "2", "8", "8", "1",
"9", "7", "3", "2", "9", "6", "3", "3", "4", "1", "10", "2", "2", "5", "9"}
)
),
New Column( "Date/Seen",
Numeric,
"Nominal",
Format( "m/d/y", 12 ),
Input Format( "mmddyyyy" ),
Set Selected,
Set Values(
[3545078400, 3517603200, 3468873600, 3413232000, 3461875200, 3491596800, 3298492800, 3471379200,
3390940800, 3384460800, 3476217600, 3544819200, 3521664000, 3324672000, 3400272000, 3394224000,
3463776000, 3314390400, 3553718400, 3516393600, 3494016000, 3530908800, 3476476800, 3345753600,
3521232000, 3553286400, 3466800000, 3397248000, 3487881600, 3339792000, 3510691200, 3269635200,
3488486400, 3464640000]
)
)
);
// Sort the table so that all visits for a given individual are together
// and in asscending order of the visit date
dt << Sort( By( :ID, :Name( "Date/Seen" ) ), Order( Ascending, Ascending ), Replace table( 1 ) );
// Create a new column which is just a simple counter of the visit number
dt << New Column( "Visit Number",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
If( Lag( :ID ) != :ID,
num = 1,
num = num + 1
);
num;
)
);
// Split the data by the visit number
dt << Split(
Split By( :Visit Number ),
Split( :Name( "Date/Seen" ) ),
Group( :ID ),
Sort by Column Property
);