全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1443 6
2010-11-25
if (first.user_id and flag_maxmin in(-99,99))  and (last.user_id and flag_maxmin in(-99,99)) then month_new=3;
请教这个代码有啥问题么?不能这么用么?
呵呵 结果表明是不能这么用的
请指教
二维码

扫码加我 拉你入群

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

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

全部回复
2010-11-26 01:07:46
1# xiaoxiahu0571
why?
我想这个或许在逻辑上不是你想要的,但是语法上应该没有什么问题吧
二维码

扫码加我 拉你入群

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

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

2010-11-26 07:25:14
代码应该没有问题:
data test;
    user_id=1;
    flag_maxmin=99;
run;
data test1;
    set test;
    by user_id;
    if (first.user_id and flag_maxmin in(-99,99))  and (last.user_id and flag_maxmin in(-99,99)) then do;
           month_new=3;
           put "This works!";
    end;
run;


if句的逻辑就相当于: if first.user_id   and last.user_id and flag_maxmin in(-99,99) then month_new=3;
二维码

扫码加我 拉你入群

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

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

2010-11-26 09:30:13
1 99 3
1 0 3
1 0 3
1-99 3
2 0 1
2 99 2
2-99 3
2 0 3
3 -99 3
3 0 3
3 99 3

就是一组类似这样的测试书库,比如user_id=2的时候我已经写出来了,当1和3组内的第一个和最后一个对应的flag_maxmin=-99 或者99时候,就统一打个标签3 麻烦再指教
二维码

扫码加我 拉你入群

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

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

2010-11-26 09:48:55
用or就可以了


求职招聘    在线投稿
经管百科    三人行网

我也想创建词条赚积分


if (first.user_id and flag_maxmin in(-99,99))  or (last.user_id and flag_maxmin in(-99,99)) then month_new=3;


或者:
if (first.user_id or last.user_id) and flag_maxmin in (-99,99) then month_new=3;
二维码

扫码加我 拉你入群

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

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

2010-11-26 09:57:04
复制代码
不知道是不是这个意思,东施效颦了一下
就当做练习作业。。。。。。
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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