data a;
input jobcode $;
datalines;
actor1
actor2
actor3
data b;
set a ;
if jobcode in ('actor1','actor2') then joblevel='beginner';
if jobcode='actor3' then joblevel='advanced';
else joblevel='unknow';
run;
那在这一段代码中,第二个条件判断如果改为else if 结果就会不一样,这是为什么呢?if和有else if
什么分别
分析的太到位了,我明白了。我看过下面的一个英文解释,但就不怎么看得懂,也把它写出来吧!最后谢谢您了!!!
The DATA step will continue to process those observations that satisfy the conditon in the first IF statement Althouth
jobcode might be set to beginner for one or more observations.the condition on the second IF statement will evaluate
as false,and the ELSE statement will execute and overwrite the value of jobcode as unknow.