全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1583 1
2016-06-16

Given the SAS data set work.test;
X Y
5 2
3 1
5 6
The following SAS program is submitted:

data one two three;
set work.test;
if X eq 5 then output one;
if Y lt 5 then output two;
else output three; (原题 output)
run;

问每个data set各有几个观测值,回家运行了一下应该是:
work.one: X Y
                5  2
                5  6
work.two: X Y
                5  2
                3  1
work.three: X Y
                 5 6
所以各有2,2,1个observations
想请教这题的具体原理?else output three 语句只对应 If Y lt 5 then这条语句?谢谢大家!

二维码

扫码加我 拉你入群

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

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

全部回复
2016-6-16 22:20:45
SAS online(http://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001343763.htm)上有这么一句话:

After SAS processes an OUTPUT statement, the observation remains in the program data vector and you can continue programming with it. You can even output it again to the same SAS data set or to a different one.

所以这个就是按照从上到下顺序执行,其中最后else 和前一个if 为配套,所以答案也可以理解了
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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