作者tew (咖啡王子)
站内Statistics
标题Re: [问题] SAS程式码问题
时间Mon Sep 3 01:08:46 2012
※ 引述《FSGuitar (fingerstyle)》之铭言:
: 请问一下
: SAS有可能办到
: 一个指令就把所有的variable都加上一个数字或字母在每一个variable後呢?
: 谢谢
proc contents noprint data=work.yourfile out=b(keep=name);
run;
data _null_;
set b nobs=x;
call symputx('x',x);
run;
%macro addroot(a)
;
%do i=1 %to &x;
data _null_;
set b;
if _n_=&i then do;
len=length(name);
call symput('root',substr(name,1,len));
end;
run;
data a;
set a;
rename &root=&root&a;
run;
%end;
%mend;
%addroot(a);
a可以任意修改成你要的字根
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.45.194.205
※ 编辑: tew 来自: 114.45.194.205 (09/03 01:09)
1F:推 FSGuitar:感谢!! 09/05 19:23