열 반복열 목록을 반복하는 스크립트를 작성 중인데 문제가 발생했습니다. ":Technology Default" 형식으로 열 참조를 출력할 수 있어야 하지만 제가 본 모든 방법은 "Column("Technology Default")"를 출력합니다. 온라인에서 찾아보니 필요한 참조가 있는 것 같습니다. 내가 얻는 것이 "열 개체 참조"일 때 "열 참조"입니다. 내가 원하는 것을 수행하는 간단한 방법이 있습니까?
자동화 및 스크립팅Re: 열 반복무엇을 하려고 하시나요? 사용할 수 있는 AsColumn() 및 Column()(때로는 Eval())이 있습니다(해당 형식의 경우 As Column()은 일반적으로 작동하지만 표현식과 함께 사용해야 할 수도 있음).
편집하다:
몇 가지 링크:
예를 들어 수식에서 해당 형식을 얻으려면 EvalExpr + Name Expr + As Column이 일반적으로 시작하는 방법입니다.
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
colname = "height";
Eval(EvalExpr(
dt << New Column(Eval Insert("^colname^*^colname^"), Numeric, Continuous, Formula(
Expr(Name Expr(AsColumn(dt, colname))) * Expr(Name Expr(AsColumn(dt, colname)))
));
));
Re: 열 반복나의 최종 목표는 새 열의 수식에 사용할 수 있는 것을 만드는 것입니다. 수식은 보이는 대로 ":Column"으로 지정된 경우에만 열을 인식합니다. 어쨌든, 이 링크에서 찾은 정보의 도움으로.
해결됨: 문자열에서 큰따옴표를 바꾸는 방법 - JMP User Community
나는 목표를 달성하기 위해 무차별 대입 방법을 생각해 냈습니다. 우아하지는 않지만 작동하는 것 같습니다. 이 작업을 보다 공식적으로 수행하는 방법에 대한 제안은 여전히 열려 있습니다.
안녕
스패너헤드
dt = Current Data Table();
lst = dt << Get Column Names(string);
For(i=1,i<=NItems(lst),i++,
colName = lst[i];
col = Column(colName);
Colstring = (":"||colName);
Colref = Parse( Eval Insert(Colstring));
Show(Colref););Re: 열 반복일반적으로 JMP에서와 같은 열 참조는 관리하기가 너무 귀찮기 때문에 엉망으로 만들지 않을 것입니다. -> 열 이름의 문자열을 사용하고 필요에 따라 Column(), As Column(), Eval() 또는 NameExpr과 함께 사용합니다. (AsColumn()) (어떤 이유로 열 참조 (Column("something")) 을 사용해야 하는 경우 << Get Name을 사용하여 이를 문자열로 변환합니다.)
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
col1 = "height";
col2 = "weight";
<BR />// Good way but can be (sometimes) difficult to read
Eval(EvalExpr(
dt << New Column("mycol1", Numeric, Continuous, Formula(
Expr(Name Expr(AsColumn(dt, col1))) * Expr(Name Expr(AsColumn(dt, col2)))
))
));
<BR />// might be easier to read
Eval(Substitute(
Expr(dt << New Column("mycol2", Numeric, Continuous, Formula(
_firstcol_ * _secondcol_
))),
Expr(_firstcol_), Name Expr(AsColumn(dt, col1)),
Expr(_secondcol_), Name Expr(AsColumn(dt, col2))
));
// "reusable"
ref1 = Name Expr(AsColumn(dt, col1)); // this will return :height BUT you will generally still need Name Expr() to use it
ref2 = Name Expr(AsColumn(dt, col2));
// wont work, because ref1 will get evaluated for "current" row
Eval(EvalExpr(
dt << New Column("mycol3", Numeric, Continuous, Formula(
Expr(ref1) * Expr(ref2)
))
));
// will work
Eval(EvalExpr(
dt << New Column("mycol3", Numeric, Continuous, Formula(
Expr(Name Expr(ref1)) * Expr(Name Expr(ref2))
))
));
그냥 사용하려고했다면
dt << New Column("mycol4", Numeric, Continuous, Formula(
ref1 * ref2
));
수식으로 평가되지 않으므로 ref1*ref2와 같은 수식으로 끝납니다.

추가 링크:
Re: 열 반복제가 잘못된 나무를 짖고 있을 수도 있지만, 당신이 겪고 있는 문제는 수식에서 열 참조를 사용하고 있다는 것 같습니다. 그리고 당신이 해야 할 일은 수식이 생성될 때 그 참조를 해결하는 것입니다. Jarmo의 예는 바로 그것을 하는 예를 제공하지만, 약간 혼란스러울 수 있습니다. 아래는 매우 간단한 예에서 문제와 해결책을 설명하려는 시도입니다.
// Here is a sample script, that creates a new data table
// with 2 columns, and what we want to do, is to simply
// put the value 1 into column c1, and a 2 into column c2
// In the first example, it is done by simply running a
// for() loop and taking the index variable, "i" and using it in
// the formula and squaring it's value.
Names Default To Here( 1 );
dt = New Table( "Example" );
dt<< add rows(1);
For( i = 1, i <= 2, i++,
dt << New Column( "c" || Char( i ),
formula( i^2 )
)
);
// When each column was created, it used the value of i at that
// time within the formula. Thus, for c1, the value of i was 1,
// and for c2 it was 4.
// So now, if we rerun the formulas, it will take the value of
// i at the time of rerunning each formula.
wait(5);
dt<<RERUN formulas=""></RERUN>
<P>이것이 도움이 되길 바랍니다</P>Re: 열 반복"무차별적인 폭력" 대신에
Colstring = (":"||colName);
Colref = Parse( Eval Insert(Colstring));좀 더 우아한 방법은 다음과 같습니다.
Colref= Name Expr (As Column(colName))
-> @jthi 의 답변을 참조하세요.
이미 다른 많은 사용자에게 도움이 되었습니다: JMP에서의 표현식 처리: Tipps 및 Trapdoors
그런데:
귀하의 예에서 열 이름 가져오기 를 통해 콜레프( s)를 직접 가져올 수 있습니다. STRING 인수만 제거하면 됩니다.
앞에 ":"가 없는데 이건 그냥 화장품이에요:)
dt = Current Data Table();
lst = dt << Get Column Names();
For( i = 1, i <= N Items( lst ), i++,
Show( lst[i] );
Show( lst[i][5] );
);
Re: 열 반복열 이름 앞에 ":"를 붙이는 것을 선호하는 경우 다음과 같은 방법을 사용할 수 있습니다.
그들 각자에게 이름을 물어보세요.
columnNames = current data table() << Get Column Names;
for (i=1, i<= Nitems(columnNames),i++,columnNames[i]<< get name() );
show(columnNames) // -> column names with leading ":"