SAS如果有其他多个条件
提示是如果患者有三种症状(头痛、恶心和疲劳),则疾病=1。机器发出红旗“语句无效或使用顺序不正确”。非常感谢 这是一个语法错误。应该是:SAS如果有其他多个条件,sas,Sas,提示是如果患者有三种症状(头痛、恶心和疲劳),则疾病=1。机器发出红旗“语句无效或使用顺序不正确”。非常感谢 这是一个语法错误。应该是: if (symptom = 'headache' and symptom = 'nausea' and symptom = 'fatigue') then disease = 1; else disease = 0; format disease diseasef.; proc freq data = xls_sas; title 'Freque
if (symptom = 'headache' and symptom = 'nausea' and symptom = 'fatigue') then disease = 1;
else disease = 0;
format disease diseasef.;
proc freq data = xls_sas;
title 'Frequency Tabulation Disease X';
tables disease;
run;
您可能需要学习SAS的基本语法:您有一个逻辑错误。对于任何给定的观察,可变症状只能包含一个值。因此,它的价值不可能同时是头痛和恶心。您是否正在尝试跨多个观察点进行测试?或者可能在一次观测中跨越多个变量?一个变量只包含一个值,所以它不能同时是三个不同的值(欢呼上帝和上帝)。(傻笑/露齿而笑)也可能只是编码
disease=0代码>是的,@Richard。我有多粗心_
data xls_sas;
set xls_sas;
if (symptom = 'headache' and symptom = 'nausea' and symptom = 'fatigue') then disease = 1;
else disease = 0;
format disease diseasef.;
run;
proc sort data=xls_sas nodupkey;
by patient symptom;
run;
data xls_sas(drop=symptom);
set xls_sas;
by patient;
format disease diseasef.;
retain flag 0;
if first.patient then flag=0;
if symptom in ('headache', 'nausea', 'fatigue') then flag+1;
if flag=3 then disease=1;
else disease=0;
if last.patient;
run;