SAS:服务器摆烂把数据集存到本地Excel

2023-10-27_17-40-39.png
%macro m_exp2all(_lib=, _dsin=);
    %if not %length(&_dsin) %then
        %do;

            proc sql noprint nowarnrecurs;
                select distinct memname into: _dsin separated by ' ' from 
                    dictionary.columns where libname="%upcase(&_lib)";
            quit;

        %end;
    %let _dsnum=%sysfunc(countw(&_dsin, %str( )));
    libname exfile xlsx "/location/%upcase(&protocol)_%lowcase(&report)_%lowcase(&_lib)_all_&sysdate..xlsx";

    %do iii=1 %to &_dsnum;
        %let _tmpds=%Scan(&_dsin, &iii, %str( ));

        data exfile.&_tmpds.;
            %if %length(&_lib) %then
                %do;
                    set &_lib..&_tmpds.;
                %end;
            %else
                %do;
                    set &_tmpds.;
                %end;
        run;

    %end;
    libname exfile clear;
%mend m_exp2all;

 %m_exp2all(_lib=data_s, _dsin=); 
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容