Re: [問題] SAS程式碼問題
※ 引述《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)
推
09/05 19:23, , 1F
09/05 19:23, 1F
討論串 (同標題文章)