if ステートメントのヘルプこんにちは、
おそらくここで基本的なものが欠けています。 他の 2 つの列値を組み合わせて列の値を変更しようとしています。 次の if ステートメントを入力しても、列の値は変わりません。 ここで何が足りないのでしょうか? ヒントやアドバイスをありがとうございます。
Names Default To Here( 1 );
dt = Data Table( "20210811Miflezet_CAPCMP.jmp" );
dt << Begin Data Update;
If( :justice_decision_REC_RILE2 == "reject" & :RILE_Calc2a == "center"
,
:Rile_Calc3 == "center"
,
:justice_decision_REC_RILE2 == "accept" & :RILE_Calc2a == "center"
,
:Rile_Calc3 == "center"
,
:justice_decision_REC_RILE2 == "reject" & :RILE_Calc2a == "left"
,
:Rile_Calc3 == "right"
,
:justice_decision_REC_RILE2 == "accept" & :RILE_Calc2a == "left"
,
:Rile_Calc3 == "left"
,
:justice_decision_REC_RILE2 == "reject" & :RILE_Calc2a == "right"
,
:Rile_Calc3 == "left"
,
:justice_decision_REC_RILE2 == "accept" & :RILE_Calc2a == "right"
,
:Rile_Calc3 == "right"
);
dt << End Data Update;
消費者および市場調査データのブレンディングとクリーンアップRe: if ステートメントに関するヘルプそれは実際にうまくいきました。 を使用して小さな調整を1つ行いました@jthiの投稿に小さな変更を加えました@Craige_Halesのコード。 私にとってうまくいった最終的な形式は次のとおりです。
dt = Data Table( "20210812Miflezet_CAPCMP.jmp" );
For Each Row(
If(
:just_dec_rec == "reject" & :RILE_Rec == "center", :RILE4="center",
:just_dec_rec == "accept" & :RILE_Rec == "center", :RILE4= "center",
:just_dec_rec == "reject" & :RILE_Rec == "left", :RILE4= "right",
:just_dec_rec == "accept" & :RILE_Rec == "left", :RILE4="left",
:just_dec_rec == "reject" & :RILE_Rec == "right", :RILE4="left",
:just_dec_rec == "accept" & :RILE_Rec == "right", :RILE4="right"
));
Re: if ステートメントに関するヘルプ元の JSL では、おそらく (編集: も) 変更したいと思うでしょう
Rile_Calc3 == "center" // compare. the result of the compare (0 or 1) will be the result of the if(), see below
に
Rile_Calc3 = "center" // assign value
JSL if ステートメントは値を返します。次のように書くこともできます
:Rile_Calc3 = If(
:justice_decision_REC_RILE2 == "reject" & :RILE_Calc2a == "center", "center",
:justice_decision_REC_RILE2 == "accept" & :RILE_Calc2a == "center", "center",
:justice_decision_REC_RILE2 == "reject" & :RILE_Calc2a == "left", "right",
:justice_decision_REC_RILE2 == "accept" & :RILE_Calc2a == "left", "left",
:justice_decision_REC_RILE2 == "reject" & :RILE_Calc2a == "right", "left",
:justice_decision_REC_RILE2 == "accept" & :RILE_Calc2a == "right", "right",
:Rile_Calc3 // or "Unknown" ? depends how you want to handle the unexpected case.
);
予期しないケースが存在しないことがわかっている場合は、最後の else 句を省略できます。 しかし、予期せぬケースは、予期せぬときに現れるという性質があります。
秘密の場合
Re: if ステートメントに関するヘルプご回答ありがとうございます! さまざまなスクリプト ガイドに示されているように、これは正しいはずですが、ここでは機能しませんでした。 データテーブルと、これらの変数に対してすでに行ったすべての処理に何か問題があったのだと思います。 最終的に、回避策は 2 つの名目上の列を 1 つに連結し、そこで得られた式を望ましい結果に再コード化することでした。 再度、感謝します。
Re: if ステートメントに関するヘルプFor Each Row または Set Each Value を使用できます。 以下に例を示します。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
For Each Row(
If(:sex == "F",
:age = .
);
);
dt:weight << Set Each Value(
If(:sex == "M",
.,
:height
);
);