全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1605 2
2020-04-16
SAS中不后缀"then..."的IF指令,其具体意义和产出是啥呢?什么情况下要这么写呢?请大神指点!谢谢~
以下是指令代码:
图片1.jpg
以下是该指令的输出,似乎if last.dept; 这句没有发挥特殊作用,那么如果不写这句呢?输出结果会有不同吗?请指点:
图片2.jpg

二维码

扫码加我 拉你入群

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

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

全部回复
2020-4-17 00:00:53
if last.byvar, 只保留byvar(你的code中为dept)的最后一个观测:即只保留根据dept sort后的最后一个观测。参考如下code
复制代码


二维码

扫码加我 拉你入群

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

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

2020-4-17 10:42:42
The subsetting IF statementcauses the DATA step to continue processing only those raw data recordsor those observations from a SAS data set that meet the conditionof the expression that is specified in the IF statement. That is,if the expression is true for the observation or record (its valueis neither 0 nor missing), SAS continues to execute statements inthe DATA step and includes the current observation in the data set.The resulting SAS data set or data sets contain a subset of the originalexternal file or SAS data set.

If the expression isfalse (its value is 0 or missing), no further statements are processedfor that observation or record, the current observation is not writtento the data set, and the remaining program statements in the DATAstep are not executed. SAS immediately returns to the beginning ofthe DATA step because the subsetting IF statement does not requireadditional statements to stop processing observations.
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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