-1
次のコードを実行しようとしていますが、正しく動作しません。問題は、それぞれcase when
が次の文を上書きするということです。IF/ELSE IF文としてPROC SQLを使用する
だから、私は何をする必要があることはIF/ELSE IF
staetmentですが、私は
proc sql;
create table example
as select *,
case when B.variable = 'X' then 1 else 0 end as variable_X,
case when B.variable = 'Y' then 1 else 0 end as variable_Y,
case when B.variable = 'Z' then 1 else 0 end as variable_Z,
case when B.variable = 'W' then 1 else 0 end as variable_W,
case when B.variable = 'R' then 1 else 0 end as variable_R,
case when B.variable = 'G' then 1 else 0 end as variable_G,
case when B.variable = 'T' then 1 else 0 end as variable_T,
case when B.variable = 'U' then 1 else 0 end as variable_U,
case when B.variable = 'P' then 1 else 0 end as variable_P,
case when B.variable = 'L' then 1 else 0 end as variable_L
FROM my_table as A
LEFT JOIN my_second_table as B
on A.KEY1=E.KEY1 and A.KEY2=E.KEY2
;
PROC-SQLで「私はすでに
group by
ステートメントを使用しようとしましたが、それはdidnのことを行う方法がわかりません仕事。
P .:私の実際のコードは私の例よりもはるかに大きく、8 left join
とはるかに多くの変数があります。私はちょうどそれの抽出物を投稿した。
"上書き"についてのあなたのコメントは理にかなっていません。上記のことを確かに(多かれ少なかれ)行うことができ、潜在的に有効な結果を得ることができます。 – Joe