andy162639 发表于 2011-11-9 00:44 
是否能提供代码呢,SQL用的很少。。。谢谢
我的意思是说,haricH的那个code里面,用了一段sql
proc sql noprint;
select name into:name_list separated by '-'
from b
where varnum>=&cutnum.
order by varnum
;
quit;
此段sql的功能,是生成宏变量name_list,包含所有需要改成missing的变量名,用'-'分隔。但是由于你的变量名太多,导致name_list这个宏变量突破了sas允许的宏变量的最大长度。所以报错了,解决方法之一是写到外部文件,比如:
data a;
input a b c d e f g h;
cards;
1 2 3 4 5 6 2 4
5 6 3 2 4 5 6 7
3 4 5 6 7 8 2 5
;
filename out 'c:\out.sas';
options source2;
proc contents data=a out=var noprint;run;
data var;
set var;
where varnum>=2;
if _n_=1 then name='array mis{*} '||trim(name);
run;
data _null_;
file out;
set var;
put name;
run;
data b;
set a;
%include out;
;
if _n_>=2 then do i=1 to dim(mis);
mis(i)=.;
end;
drop i;
run;
这段code从第二行开始,对第二个及其以后的变量赋缺失值,要求c盘根目录不能写保护。仅供参考。