だから、私は診療所の訪問日ごとに行があります。 現在、すべての診療所訪問日は「DateSeen」の下の同じ列に記録されています。代わりに、患者IDごとに1行必要で、来院ごとに個別の列を作成する必要があります(時系列)。 例えば、「1回目の訪問、2回目の訪問、3回目の訪問」など、5回目の訪問まで。
誰かが手伝ってくれる?明白な理由のために、私は実際のデータを共有することができませんが、ここにいくつかのダミーデータがあります。
| ID | DateSeen |
| 8 | 5/3/2016 |
| 8 | 2015年6月20日 |
| 1 | 2013/12/3 |
| 10年 | 2/28/2012 |
| 9 | 2013/09/13 |
| 9 | 8/23/2014 |
| 6 | 7/10/2008 |
| 3 | 1/1/2014 |
| 2 | 2011年6月15日 |
| 5 | 2011年4月1日 |
| 1 | 2/26/2014 |
| 3 | 2016/04/30 |
| 1 | 2015年8月6日 |
| 9 | 5/9/2009 |
| 4 | 2011年10月1日 |
| 2 | 7/23/2011 |
| 8 | 2013/10/5 |
| 8 | 1/10/2009 |
| 1 | 2016年8月11日 |
| 9 | 6/6/2015 |
| 7 | 2014年9月20日 |
| 3 | 2015/11/21 |
| 2 | 2014年3月1日 |
| 9 | 1/8/2010 |
| 6 | 2015年8月1日 |
| 3 | 2016/06/06 |
| 3 | 11/9/2013 |
| 4 | 2011年8月27日 |
| 1 | 7/11/2014 |
| 10年 | 10/31/2009 |
| 2 | 2015年4月1日 |
| 2 | 2007年8月11日 |
| 5 | 7/18/2014 |
| 9 | 2013/10/15 |
明らかに私は少し混乱しました。 私が含めたスクリプトでは、最初のステートメントに含めたデータテーブルを作成するステップを含めました。 私のコードのその部分は、私が答えたものをいくつかのサンプルデータで実行できるようにすることだけでした。 実際に作業を行うスクリプトの一部は、無制限の数の患者で実行できます。 ですから、大規模なデータテーブルを作成し、作成したスクリプトの最後の部分を実行するだけです。 患者ID欄が "ID"、日付欄が "Date / Seen"であることを確認してください。 また、"Date / Seen"列は数値のJMP Date列である必要があります。
// 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
);
あなたは素晴らしいです!どうもありがとうございます!これは私を強調していました!私はあなたがあなたの次のフライトでファーストクラスへの無料アップグレードを得ることを願っています。 
これはあなたが望むことをする簡単なスクリプトです。 スクリプトの手順に従うと、これら3つの操作を対話的に実行するのは簡単です。
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
);