如果我们在SAS progrm中有多个where条件,那么可以回答,那么为什么输出显示的位置呢?

问题描述 投票:0回答:1

如果我们在SAS程序中有多个where条件,那么可以解答为什么输出始终显示在哪里?

它是如何逻辑执行的?

sas where
1个回答
2
投票

SAS日志很好地解释了发生了什么。

18   data test;
19    set sashelp.class ;
20    where age=12;
21    where sex='M';
NOTE: WHERE clause has been replaced.
22   run;

NOTE: There were 10 observations read from the data set SASHELP.CLASS.
      WHERE sex='M';
NOTE: The data set WORK.TEST has 10 observations and 5 variables.

如果要添加到过滤条件,请使用where also命令(也称为where and)。

23   data test;
24    set sashelp.class ;
25    where age=12;
26    where also sex='M';
NOTE: WHERE clause has been augmented.
27   run;

NOTE: There were 3 observations read from the data set SASHELP.CLASS.
      WHERE (age=12) and (sex='M');
NOTE: The data set WORK.TEST has 3 observations and 5 variables.
© www.soinside.com 2019 - 2024. All rights reserved.