2017-07-17 83 views
0

我有來自2x2x3實驗的數據。對於這個數據集,我有3個操作問題。我在調查中爲這些問題創建了三個嵌入數據字段,標籤爲「正確」和「錯誤」。SPSS - 根據3個字符串問題拆分文件

現在,我想將我的文件分成四個版本,看看回答3個操作問題是否對我的結果有影響。

爲了捕獲正確/錯誤的操作問題(ResponseReason,Attribution,Measure),我試圖創建一個過濾器變量 - 沒有成功。

我對過濾器變量代碼:

Do 
if (ResponseAttribution = "Correct" and ResponseMeasure = "Correct" and ResponseReason = "Correct"). 
    FilterVar = 3. 
ELSE if ((ResponseAttribution = "Correct" and ResponseMeasure = "Correct") or (ResponseAttribution = "Correct" and ResponseReason = "Correct") or (ResponseMeasure = "Correct" and ResponseReason = "Correct")). 
    FilterVar = 2. 
Else if ResponseAttribution = "Correct" or ResponseMeasure = "Correct" or ResponseReason = "Correct". 
    FilterVar = 1. 
else. 
    FilterVar = 0. 
end if. 
EXECUTE. 

回答

0

試試這個:

compute FilterVar = sum(ResponseAttribution="Correct", 
     ResponseMeasure="Correct", ResponseReason="Correct"). 

另外,您可以創建新的變量,並用它們來計算濾波器如下(這樣會更容易如果您稍後想根據其他組合對濾鏡進行更改):

recode ResponseAttribution ResponseMeasure ResponseReason (convert) ("Correct"=1) 
    into Att Msr Rsn. 
compute FilterVar=sum(Att, Msr, Rsn).