xpt2sas(批量xport⽂件转为sas⽂件)Folder 如下: 刀具
论坛
xpt2sas 代码如下:
正交表/**
**/毛宣国
%macro xpt2sas;
data _null_;
call system("cd /file/raw/xpt");
run;
filename _dir pipe 'ls -la *.xpt' ;
data _import(keep=line);
length _dirline $200;
length _file $20;
length line $200.;胡 温
infile _dir recfm=v lrecl=200 truncover ;
input _dirline $1-200 ;
_file = scan(_dirline, 9, " ");
line = '%xpt2loc(libref=rawdata,filespec='||"'"||'/file/raw/xpt/'||strip(_file)||"'"||');';output; run;
filename outfile "/file/raw/xpt2loc.sas";
data _null_;
set _import end=eof;
file outfile dlm="" lrecl=32000;
put line;
x "perl -i -pe 's/\n/\r\n/g' /file/raw/xpt2loc.sas";
逆向建模filename outfile clear; %mend;
%xpt2sas;
libname rawdata '/file/raw/';
%include '/file/raw/xpt2loc.sas';