我是SAS语言学习的初学者。我了解到SAS中有五个Special_where操作员。其中一个是WHERE SAME AND运算符。有人能帮我如何使用的例子吗
提前感谢
您可以在DATA步骤中使用WHERE
语句,也可能在PROC步骤中更有用。WHERE SAME AND
在它的另一个名称WHERE ALSO
下可能更容易记住,它将允许您使用多个语句来添加更多的限制。
这一点很容易通过以下示例看到:
proc means data=sashelp.class ;
where sex='M';
where also age > 12 ;
var height;
run;
因为SAS将把得到的子设置条件回显到LOG。
1334 proc means data=sashelp.class ;
1335 where sex='M';
1336 where also age > 12 ;
NOTE: WHERE clause has been augmented.
1337 var height;
1338 run;
NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: There were 6 observations read from the data set SASHELP.CLASS.
WHERE (sex='M') and (age>12);
请注意,如果同时使用WHERE
和WHERE ALSO
语句,则顺序会有所不同。
1339 proc means data=sashelp.class ;
1340 where also age > 12 ;
NOTE: WHERE clause has been augmented.
1341 where sex='M';
NOTE: WHERE clause has been replaced.
1342 var height;
1343 run;
NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: There were 10 observations read from the data set SASHELP.CLASS.
WHERE sex='M';
但您总是可以对所有语句使用WHERE ALSO
,然后顺序就无关紧要了。
1344 proc means data=sashelp.class ;
1345 where also age > 12 ;
NOTE: WHERE clause has been augmented.
1346 where also sex='M';
NOTE: WHERE clause has been augmented.
1347 var height;
1348 run;
NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: There were 6 observations read from the data set SASHELP.CLASS.
WHERE (age>12) and (sex='M');