0

SASでdrop_conditionsを学んでいます。3 つの変数のサンプルをリクエストしていますが、2 つの観測値しか取得されません。お知らせ下さい!ありがとうございました!

data temp;
set mydata.ames_housing_data;
format drop condition $30.;
if (LotArea in (7000:9000)) then drop_condition = '01: Between 7000-9000 sqft';
else if (LotShape EQ 'IR3') then drop_condition = '02: Irregular Shape of Property';
else if (condition1 in 'Artery' OR 'Feedr') then drop_condition = '03: Proximity to arterial/feeder ST';

run;

proc freq data=temp;
tables drop_condition;
title 'Sample Waterfall';
run; quit;

出力

4

1 に答える 1

1

IN条件/比較が正しく指定されていません。1 行で複数の比較を行う演算子を探していると思います。ログにエラーがないことに驚いています。

以下ではなく:

if (LotArea = 7000:9000)

試す:

if (lotArea in (7000:9000))

if (condition1 EQ 'Atrery' OR 'Feedr')

する必要があります

if (condition1 in ('Atrery', 'Feedr'))

編集:変数が指定されたテキストを保持するのに十分な長さであることを確認するための形式ではなく、drop_condition 変数の長さを指定する必要もあります。指定された条件に対して proc freq を使用して、後で回答を検証することも役立ちます。たとえば、次のようになります。

proc freq data=temp;
where drop_condition=:'01';
tables drop_condition*lot_area;
run;
于 2016-01-01T02:25:48.827 に答える