SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 637|回复: 1
打印 上一主题 下一主题

求助!如何在程序中判断一个数据集为空?

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2007-10-18 11:20:05 | 只看该作者

求助!如何在程序中判断一个数据集为空?

比如说有两个数据集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;

……………………
请指点!
回复 支持 反对

使用道具 举报

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
沙发
 楼主| 发表于 2007-10-18 16:19:15 | 只看该作者

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.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2026-2-4 10:32 , Processed in 0.069287 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表