동적으로 이름별로 열을 반복하고 그룹화하는 스크립트그래서 나는 이것을 알아 내려고 노력하고 있으며 그것이 제대로 작동하지 않습니다.
나는 키-값 쌍이 있는 테이블을 가지고 있는데 키-값 쌍을 높이에서 넓이로 분할했습니다. 다음과 같이 모두 일반 명명 구조를 갖는 약 10,000개의 열로 끝납니다.
"15.02.0 param1", "15.02 param2", "15.02 param3"...."15.03 param1", "15.03 param2", "15.03 param3",...
이 모든 열을 살펴보고 시작 용어에 따라 동적으로 그룹화하려면 어떻게 해야 합니까? 즉. 그룹의 모든 15.02% 열, 모든 15.03% 열, 모든 15.04%, ... 모두 17.06%.... 그리고 groupby 번호를 기반으로 그룹 이름을 지정하시겠습니까?
내 스크립트는 모든 것을 단일 그룹으로 그룹화합니다. 어.
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :EquipmentId, :ChamberId, :LotId, :SlotNo ))
);
dtAggWide = current data table();
ColNamesList = dtAggWide << get column names(string, continuous); //get the column names of the WIDE table
//Create an empty list for the matching columns
RecipeStepList = {};
// Find matching column names
For( i = 1, i <= N items( RecipeStepIndex ), i++,
For( j = 1, j <= N Items( ColNamesList ), j++,
If(
Contains( ColNamesList[j], RecipeStepIndex[i] ),
Insert Into( RecipeStepList, ColNamesList[j] ),
);
);
);
// If groups of columns are found, create Col groupings
If( N Items( RecipeStepList ) > 0,
dtAggWide << select columns( RecipeStepList );
dtAggWide << group columns();
);스크립팅Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트이를 수행하는 방법에는 여러 가지가 있습니다.
다음은 먼저 그룹을 그룹 이름으로 키를 사용하여 연관 배열로 만들고 값은 그룹의 열 목록으로 만든 다음 해당 연관 배열을 반복하여 데이터 테이블의 열을 그룹화하는 한 가지 예입니다. 그룹 이름을 얻으려면 열 이름에 Word() 함수를 사용합니다. For Each를 사용하기 때문에 JMP16이 필요합니다.
Names Default To Here(1);
// this solution requires JMP16
dtAggWide = New Table("Untitled",
Add Rows(0),
New Column("15.02.0 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param2", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
col_list = dtAggWide << Get Column Names("String");
// first get the column group names and columns<BR />// in this solution case we use associative array
aa_groups = Associative Array();
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = {};
);
Insert Into(aa_groups[col_group], col_name)
);
Show(aa_groups);
For Each({{key, value}}, aa_groups,
dtAggWide << Group Columns(key, value);
);

Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트감사합니다. 곧 시도해 보겠습니다.
그러나 그룹화 배열 목록을 동적으로 작성하는 것은 어떻습니까? 기본적으로 :RecipeStepId의 각 고유 값은 groupby 이름이어야 합니다. 처음에 테이블을 분할하기 전에 "RecipeStepIndex"에 저장하려고 시도했습니다.
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
Re: 동적으로 이름별로 열을 반복하고 그룹화하는 스크립트예를 들어 RecipeStepIndex를 기반으로 하는 열 이름으로 연관 배열을 "미리 채울" 수 있습니다. 대부분의 RecipeStepIndex는 분할 열 이름의 시작 부분에서 찾을 수 있으므로 여전히 작동해야 합니다.
Names Default To Here(1);
// this solution requires JMP16
dtAggWide = New Table("Untitled",
Add Rows(0),
New Column("15.02.0 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param2", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.02.0 param3", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param1", Numeric, "Continuous", Format("Best", 12), Set Values([])),
New Column("15.03 param2", Numeric, "Continuous", Format("Best", 12), Set Values([]))
);
col_list = dtAggWide << Get Column Names("String");
// first get the column group names and columns// in this solution case we use associative array
aa_groups = Associative Array();
//Summarize(dt, RecipeStepIndex = by(:RecipeStepId));//get list of unique RecipeStepID's
RecipeStepIndex = {"15.02.0", "15.03"};
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
Insert Into(aa_groups[col_group], col_name)
);
For Each({{key, value}}, aa_groups,
dtAggWide << Group Columns(key, value);
);