Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个试图从中创建表的数据集,但我需要过滤掉不属于这些表的观察结果。我仍在学习有关 SAS 的方法,所以我不知道如何使用条件删除观察结果。
基本上我想删除 ID 值不是四位数的观察值(就长度而言)。这可能吗?
提前致谢。
假设您的 ID 是字符,并且您不考虑空白数字:
if lengthn(id) ~= 4 then delete;
如果您的 ID 是数字:
if 1000 <= id <= 9999 then output;
如果id是字符:
id
where length(id) = 4;
如果id是数字:
where id between 1000 and 9999;