How to detect how many observations in a dataset (or if it is empty), in SAS?

后端 未结 7 1266
慢半拍i
慢半拍i 2020-11-29 04:47

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 d

7条回答
  •  不知归路
    2020-11-29 05:24

    A slightly different approach:

    proc contents data=library.dataset out=nobs;
    run;
    
    proc summary data=nobs nway;
    class nobs;
    var delobs;
    output out=nobs_summ sum=;
    run;
    

    This will give you a dataset with one observation; the variable nobs has the value of number of observations in the dataset, even if it is 0.

提交回复
热议问题