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

data perm.people (drop=type);

infile census;

retain Address;

input type $1. @;

if type='H' then input @3 address $15.;

if type='P';

input @3 Name $10. @13 Age 3. @16 Gender$1.;

run;

对于type='H'的某个记录,原文指出当遇到第二个if时,由于不满足条件,原话是Because the condition is not true, the remainingstatements are not executed and control returns to the top of the DATA step.The PDV is initialized but Address is retained.

为什么不是直接将PDV中的数据输出即执行呀?而是回到顶部重新读取了呢?

而当遇到type='P'即第二个条件满足后,原文说:Now the subsetting IF statement checksfor the condition type='P'. In this iteration, the condition is true, so thefinal INPUT statement reads the values for Name, Age, and Gender.Then the values in the program data vector are written as the first observation, and control returns to the top of the DATA step.

这个时候为什么说就可以将PDV中的数据作为第一个观测输出呢?


二维码

扫码加我 拉你入群

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

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

全部回复
2016-7-18 13:52:50
IF condition;
tests whether the condition is true. If it is true, then SAS continues processing the current observation; if it is not true, then SAS stops processing the observation, does not add it to the SAS data set, and returns to the top of the DATA step.

如果为真,则继续处理当前观测;如果为假,则停止处理当前观测,不写入数据集,并返回data步的开始。
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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