SAS中文论坛

标题: 求助!如何在程序中判断一个数据集为空? [打印本页]

作者: shiyiming    时间: 2007-10-18 11:20
标题: 求助!如何在程序中判断一个数据集为空?
比如说有两个数据集t1,t2,现在找出哪些在t1但不在t2,用tc表示,哪些在t2但不在t1, 用tr表示,然后再对tr和tc进行处理,但有可能tc和tr是空记录,如何在程序中判断tr和tc是空数据集?
data tr tc;
merge t1(in=a) t2(in=b);
if a and (not b) then output tc;
if b and (not a) then output tr;
run;

……………………
请指点!
作者: shiyiming    时间: 2007-10-18 16:19
标题: Re: 求助!如何在程序中判断一个数据集为空?
自己解决了

data _null_;
xx=open("tr");
any=attrn(xx,"any");
call symput("any",any);
run;
%put _user_;

-1 the data set has no observations or variables.
0 the data set has no observations.
1 the data set has observations and variables.




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2