全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
2299 3
2007-09-01

data work.expertise;
input Obs name level;

if level = . then
expertise = 'Unknown';
else if level = 1 then
expertise = 'Low';
else if level = 2 or 3 then
expertise = 'Medium';
else
expertise = 'High';
cards;
1 Frank 1
2 Joan 2
3 Sui 2
4 Jose 3
5 Burt 4
6 Kelly .
7 Juan 1
;
run;

为什么记录“5 Burt 4”得出来的expertise='Medium',不是应该为'High'吗?

谢谢!!

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2007-9-4 02:28:00
the problems lies on 'else if level = 2 or 3 then expertise = 'Medium'; '
'if level=2 or 3 ' should be explained as 'if level=2 or if 3' which equals to 'if level=2 or if true' which means this condition is always be true. So any value of 'level' other than '.' and '1' will fall into this category. Remember, like other programming lauguage, SAS will interepret a number ge 1 as 'true'.

The original intention of this code should use the following code ' else if level = 2 or if level = 3 then experience= 'Medium‘’

我急需论坛钱币阿.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2007-9-4 05:55:00

给予liujx80 100现金奖励

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2007-9-4 09:16:00
thank you very much!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群