亲爱的社区,
目前我正在尝试使用 JSL 自动化几个重复的 JMP 例程。 我的表在几百行代码之后现在有了我想要的形式,我在 JSL 中失败了一个所谓的简单双变量分析:(
作为一个例子,我附上了一个简化的表格。 如果你点击它是:
- X = :days, Y = :Readout, By = :Classification
- => SHIFT 热键 => 分组方式:个人 => SHIFT 热键 => 适合每个值
从编辑器复制的结果代码是:
Bivariate(
SendToByGroup( {Is Missing( :Classification )} ),
Y( :Readout ),
X( :Days ),
SendToByGroup(
{Is Missing( :Classification )},
Fit Where(
:Individuals == "Ind7",
Fit Each Value( {Line Color( {212, 73, 88} )} )
),
Fit Where(
:Individuals == "Ind22",
Fit Each Value( {Line Color( {66, 112, 221} )} )
)
),
SendToByGroup(
{:Classification == "A"},
Fit Where(
:Individuals == "Ind2",
Fit Each Value( {Line Color( {212, 73, 88} )} )
),
Fit Where(
:Individuals == "Ind4",
Fit Each Value( {Line Color( {61, 174, 70} )} )
),
Fit Where(
:Individuals == "Ind5",
Fit Each Value( {Line Color( {66, 112, 221} )} )
),
Fit Where(
:Individuals == "Ind6",
Fit Each Value( {Line Color( {204, 121, 41} )} )
),
Fit Where(
:Individuals == "Ind8",
Fit Each Value( {Line Color( {40, 182, 143} )} )
),
Fit Where(
:Individuals == "Ind9",
Fit Each Value( {Line Color( {162, 43, 221} )} )
),
Fit Where(
:Individuals == "Ind12",
Fit Each Value( {Line Color( {196, 189, 43} )} )
),
Fit Where(
:Individuals == "Ind14",
Fit Each Value( {Line Color( {39, 174, 174} )} )
),
Fit Where(
:Individuals == "Ind15",
Fit Each Value( {Line Color( {197, 41, 201} )} )
),
Fit Where(
:Individuals == "Ind24",
Fit Each Value( {Line Color( {142, 176, 40} )} )
),
Fit Where(
:Individuals == "Ind28",
Fit Each Value( {Line Color( {40, 154, 190} )} )
)
),
SendToByGroup(
{:Classification == "B"},
Fit Where(
:Individuals == "Ind1",
Fit Each Value( {Line Color( {212, 73, 88} )} )
),
Fit Where(
:Individuals == "Ind11",
Fit Each Value( {Line Color( {61, 174, 70} )} )
),
Fit Where(
:Individuals == "Ind16",
Fit Each Value( {Line Color( {66, 112, 221} )} )
),
Fit Where(
:Individuals == "Ind17",
Fit Each Value( {Line Color( {204, 121, 41} )} )
),
Fit Where(
:Individuals == "Ind21",
Fit Each Value( {Line Color( {40, 182, 143} )} )
),
Fit Where(
:Individuals == "Ind23",
Fit Each Value( {Line Color( {162, 43, 221} )} )
),
Fit Where(
:Individuals == "Ind25",
Fit Each Value( {Line Color( {196, 189, 43} )} )
),
Fit Where(
:Individuals == "Ind26",
Fit Each Value( {Line Color( {39, 174, 174} )} )
),
Fit Where(
:Individuals == "Ind27",
Fit Each Value( {Line Color( {197, 41, 201} )} )
)
),
SendToByGroup(
{:Classification == "C"},
Fit Where(
:Individuals == "Ind20",
Fit Each Value( {Line Color( {212, 73, 88} )} )
)
),
SendToByGroup(
{:Classification == "D"},
Fit Where(
:Individuals == "Ind3",
Fit Each Value( {Line Color( {212, 73, 88} )} )
),
Fit Where(
:Individuals == "Ind10",
Fit Each Value( {Line Color( {61, 174, 70} )} )
),
Fit Where(
:Individuals == "Ind13",
Fit Each Value( {Line Color( {66, 112, 221} )} )
),
Fit Where(
:Individuals == "Ind18",
Fit Each Value( {Line Color( {204, 121, 41} )} )
),
Fit Where(
:Individuals == "Ind19",
Fit Each Value( {Line Color( {40, 182, 143} )} )
)
),
By( :Classification )
);我现在的问题是,如果我像这样对它进行硬编码,这个脚本将不适用于新的个人,它将被添加到这个表中。 而且我也意识到我必须以某种形式使用列表和 For() 循环。
对于列表,我开始如下:
//Writes only the different individual values of column :Classification into a variable
classlist = dt:"Classification" << Get values;
classvalues = Associative Array(classlist) << Get Keys;
//Writes only the different individual values of column :Individuals into a variable
IDlist = dt:"Individuals" << Get values;
IDvalues = Associative Array(IDlist) << Get Keys;
但是我现在如何正确处理 For() 循环,不幸的是我不知道......
有没有人有任何想法或可以帮助我?