用户登录
用户注册

分享至

sas 导入csv

  • 作者: -心随爱痛
  • 来源: 51数据库
  • 2020-09-24
把xls改成csv试试,看看这个http://blog.csdn.net/yugao1986/article/details/7036902:
  options pageno=1 ;
  options mprint ;
  %let my_dir = d:\temp\ ;
  filename xcl_fil pipe "dir &my_dir.*.xls /b";
  %MACRO Mult_Fil(PIPEin=,DSout=);
  %LOCAL i ;
  data _NULL_ ;
  infile &PIPEin end=last;
  retain k 0 ;
  k + 1 ;
  length f_name1 f_name2 $ 60 ;
  input f_name1 $ ;
  f_name2 = "&my_dir"||trim(left(f_name1));
  ck = compress(put(k,3.));
  * This will produce both the filename ;
  * and the path/filename ;
  call symput('F'||ck,trim(left(f_name1)));
  call symput('G'||ck,f_name2);
  * Now, a count of the number of files ;
  if last then call symput('TOT_FILZ',ck);
  run;
  * Create Dataset with Dummy Record ;
  data &dsout ;
  run;
  %DO i = 1 %TO &TOT_FILZ;
  proc import datafile="&&G&i" out=__test
  dbms=excel2000 replace;
  getnames=yes ;
  data __test ;
  set __test;
  * Save the name of the file this ;
  * data came from ;
  file = "&&F&i";
  data &dsout ;
  * Stack the files ;
  set &dsout __test ;
  %END ;
  data &dsout ;
  set &dsout;
  * remove Dummy Record ;
  if _N_ = 1 then delete;
  run;
  %MEND Mult_Fil ;
  %mult_fil(PIPEin=xcl_fil,DSout=perm)
  proc print data=&syslast;
  title "Reading All Files";
  run;
软件
前端设计
程序设计
Java相关