1
這裏是頻率過程:如何手動生成虛擬變量?
爲什麼是TRD_EVENT_ROUFOR_1 & TRD_EVENT_ROUFOR_2列完全零? 爲什麼它沒有顯示其他的假人(例如TRD_EVENT_ROUFOR_8)? 問題是什麼?我的代碼哪部分是錯的?
這是我的代碼?
DATA Sampledata87_02_Mer_DumVar;
SET Sampledata87_02_Mer ;
IF TRD_EVENT_ROUFOR = '9:00' THEN TRD_EVENT_ROUFOR_1 = 1;
ELSE TRD_EVENT_ROUFOR_1 = 0;
IF TRD_EVENT_ROUFOR = '9:30' THEN TRD_EVENT_ROUFOR_2 = 1;
ELSE TRD_EVENT_ROUFOR_2 = 0;
IF TRD_EVENT_ROUFOR = '10:00' THEN TRD_EVENT_ROUFOR_3 = 1;
ELSE TRD_EVENT_ROUFOR_3 = 0;
IF TRD_EVENT_ROUFOR = '10:30' THEN TRD_EVENT_ROUFOR_4 = 1;
ELSE TRD_EVENT_ROUFOR_4 = 0;
IF TRD_EVENT_ROUFOR = '11:00' THEN TRD_EVENT_ROUFOR_5 = 1;
ELSE TRD_EVENT_ROUFOR_5 = 0;
IF TRD_EVENT_ROUFOR = '11:30' THEN TRD_EVENT_ROUFOR_6 = 1;
ELSE TRD_EVENT_ROUFOR_6 = 0;
IF TRD_EVENT_ROUFOR = '12:00' THEN TRD_EVENT_ROUFOR_7 = 1;
ELSE TRD_EVENT_ROUFOR_7 = 0;
IF TRD_EVENT_ROUFOR = '12:30' THEN TRD_EVENT_ROUFOR_8 = 1;
ELSE TRD_EVENT_ROUFOR_8 = 0;
IF TRD_EVENT_ROUFOR = '13:00' THEN TRD_EVENT_ROUFOR_9 = 1;
ELSE TRD_EVENT_ROUFOR_9 = 0;
RUN;
PROC FREQ DATA=Sampledata87_02_Mer_DumVar;
TABLES TRD_EVENT_ROUFOR*TRD_EVENT_ROUFOR_1*TRD_EVENT_ROUFOR_2*TRD_EVENT_ROUFOR_3*TRD_EVENT_ROUFOR_4*TRD_EVENT_ROUFOR_5/list ;
RUN;
而且,這裏是CONTENTS步驟:
阿明,請你能添加一些有用的數據。 –