如何在 SAS 中检测数据集(或是否为空)中的观察数? [英] How to detect how many observations in a dataset (or if it is empty), in SAS?
本文介绍了如何在 SAS 中检测数据集(或是否为空)中的观察数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有一种方法可以检测数据集是否为空,即它没有观察值.或者换句话说,如何获得特定数据集中的观察次数.
I wonder if there is a way of detecting whether a data set is empty, i.e. it has no observations. Or in another saying, how to get the number of observations in a specific data set.
这样我就可以写一个 If 语句来设置一些条件.
So that I can write an If statement to set some conditions.
谢谢.
推荐答案
使用 PROC SQL 很容易.进行计数并将结果放入宏变量中.
It's easy with PROC SQL. Do a count and put the results in a macro variable.
proc sql noprint;
select count(*) into :observations from library.dataset;
quit;
这篇关于如何在 SAS 中检测数据集(或是否为空)中的观察数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文