SAS keep/drop rename where执行顺序演示
在读入和输出数据集阶段的执行顺序是:
- keep/drop
- rename
- where
在编程处理阶段执行顺序是:
- where
- keep/drop
- rename
例子:
第一阶段:读入数据集阶段正确演示:
data want;
set sashelp.class(where=(gender="F") rename=(sex=gender) keep=name sex);
run;
第二阶段:编程阶段之正确演示:
data want;
set sashelp.class;
rename sex=gender;
keep name sex;
where sex="F”;
run;
第三阶段:输出数据集之正确演示
data want(where = (gender="F") rename=(sex=gender) keep=name sex);
set sashelp.class;
run;