3175_zh-CN
将列作为变量传递给函数以便在分发中使用嗨,
我正在尝试将列名称传递给函数,然后在分发中使用它,但它返回:
分发脚本中的命令无法识别。
无需分析数据。
它是分布中的列(varB)行。
谢谢,
亚历克斯(Jmp 8)
RuntheGraphs = function({varB},
show(varB);
分配(
统一缩放(0),
连续分配(
列(varB),
水平布局(1),
垂直(0),
算轴(1),
显示计数(1),
离群箱图(0)
)
where(:IPRO_TPT_Completed == 1)
)/*分配*/
);
c =“切片”;
RuntheGraphs(EVAL(C));
消息由以下人员编辑:alexRe:将列作为变量传递给函数以供分发使用感谢你们俩。这很棒(如果不是有点黑客)。Re:将列作为变量传递给函数以供分发使用第二次尝试:
Re:将列作为变量传递给函数以供分发使用这是我在JSL中遇到的常见问题。当所有其他方法都失败时,我构建一个表达式,然后对它使用eval(parse())。这是一些有效的代码:
style =“font-size:10pt; font-family:”Courier New“; color:black;”> RuntheGraphs
style =“font-size:10pt; font-family:”Courier New“; color:navy;”> =
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“;颜色:rgb(0,0,221);”>功能
style =“font-size:10pt; font-family:”Courier New“; color:black;”>(
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
{ varB }
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>,
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
风格= “”>
style =“font-size:10pt; font-family:”Courier New“;颜色:rgb(0,0,221);”>显示
style =“font-size:10pt; font-family:”Courier New“; color:black;”>(
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
varB )
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
风格= “”>
dist_expr
style =“font-size:10pt; font-family:”Courier New“; color:navy;”> =
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>“
风格= “”> 分配(
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
制服
缩放(0),
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
连续
分配(
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
柱(”
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:navy;”> ||
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
风格= “”> varB
风格= “”>
style =“font-size:10pt; font-family:”Courier New“; color:navy;”> ||
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>“),
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
横
布局(1),
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
垂直(
0),
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
计数
轴(1),
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
节目
计数(1),
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
局外人
方块图(0)
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
)
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
哪里(
:性别== \!“F \!” )
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>
风格= “”>
)”
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
风格= “”>
style =“font-size:10pt; font-family:”Courier New“;颜色:rgb(0,0,221);”> eval
style =“font-size:10pt; font-family:”Courier New“; color:black;”>(
style =“font-size:10pt; font-family:”Courier New“; color:rgb(0,0,221);”>解析
style =“font-size:10pt; font-family:”Courier New“; color:black;”>(
style =“font-size:10pt; font-family:”Courier New“; color:black;”> dist_expr ))
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
风格= “”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>)
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”> dt
style =“font-size:10pt; font-family:”Courier New“; color:navy;”> =
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“;颜色:rgb(0,0,221);”>打开
style =“font-size:10pt; font-family:”Courier New“; color:black;”>(
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>“$ sample_data \ big
class.jmp”
style =“font-size:10pt; font-family:”Courier New“; color:black;”>)
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”> c
style =“font-size:10pt; font-family:”Courier New“; color:navy;”> =
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:purple;”>“height”
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”> RuntheGraphs (
C )
style =“font-size:10pt; font-family:”Courier New“; color:navy;”>;
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
style =“font-size:10pt; font-family:”Courier New“; color:black;”>
Re:将列作为变量传递给函数以供分发使用我现在把这本书打开了!
你能给我这个页面吗?
(看起来你做了一个put和过去,但它在html中迷失了)Re:将列作为变量传递给函数以供分发使用嗨,亚历克斯:
跳转到JMP脚本
作者:Wendy Murphrey和Rosemary Lucas
https://support.sas.com/pubscat/bookdetails.jsp?catid=1&pc=61733
举个例子:
< -
/ *解决方案9.2 * /
/ *打开Fitness样本数据表Ni。* /
dt =打开(“$ SAMPLE_DATA / Fitness.jmp”);
/ *将条件分配给全局变量。* /
selVar =“M”;
yvar =“MaxPulse”;
xvar =“RstPulse”;
/ *构建主表达式。* /
bivExpr = Expr(
二元(
Y(:Expr(yvar)),
X(:Expr(xvar)),
/ *通过使用Expr函数包装它来标识全局变量。* /
哪里(:性别== Expr(selVar))
)
);
/ *首先解析全局变量表达式。然后解析主表达式。* /
Eval(Eval Expr(bivExpr));
适应你的特定例子:
dt = Open(“$ sample_data / Big Class.jmp”);
/ *将条件分配给全局变量。* /
c =“高度”;
/ *构建主表达式。* /
dist = Expr(分布式(
连续分配(
/ *通过使用Expr函数包装它来标识全局变量。* /
专栏(:Expr(c)),
水平布局(1),
垂直(0),
拟合分布(正常)
)
)
);
/ *首先解析全局变量表达式。然后解析主表达式。* /
Eval(Eval Expr(dist));
- >
最好的祝福,
-Matt
Comments
There are no comments yet