SAS网格启用

时间:2019-03-05 18:12:41

标签: sas

我必须提取大量数据,并且我试图通过网格使其运行速度更快。不幸的是,我不是SAS编码器,因此我正在尝试修改现有代码。我在日志的waitfor all 部分中始终收到“%END没有匹配的%DO语句”错误。我什至不确定这是否可以解决问题。

有人有网格经验可以帮助我吗?

%let _sdtm=%sysfunc(datetime());
%macro splitmonths(begmonth=,endmonth=);
%let rc=%sysfunc(grdsvc_enable(_all_,server=SASApp));
options autosignon;

%do imth=&begmonth %to &endmonth;
    signon t&imth;
    %syslput imth=&imth/remote=t&imth;
    rsubmit t&imth wait=no;
        PROC SQL;
        CREATE TABLE WORK.QUERY_FOR_VW_HOUPOSSW_FACT_&imth AS 
            SELECT t1.outletfamily, 
                t1.ppmonth, 
                t1.itemnumber, 
                /* Dollars */
                (SUM(t1.totalvalue)) FORMAT=DOLLAR20. AS Dollars
            FROM HOUPWP7.vw_houpossw_fact t1
            WHERE t1.ppmonth = &imth;
            GROUP BY t1.outletfamily,
                   t1.ppmonth,
                   t1.itemnumber;
        QUIT;
    endrsubmit;
%end

waitfor _all_
    %do imth=&begmonth %to &endmonth;
        t&imth
    %end;
    ;
signoff _all_;


data newdata;
    set
    %do imth=&begmonth %to &endmonth;
        newdata&imth
    %end;
    ;
run;

proc datasets lib=work;
    %do imth=&begmonth %to &endmonth;
        delete newdata&imth;
    %end
quit;
%mend splitmonths
%splitmonths (begmonth=541, endmonth=588)


%let _edtm=%sysfunc(datetime());
%let _runtm=%sysfunc(putn(&_edtm - &_sdtm, 12.4));
%put It took &_runtm second to run the program;enter code here

1 个答案:

答案 0 :(得分:0)

尝试添加分号以在%end语句开始之前结束waitfor宏语句。

%end;

waitfor _all_