运行输入为 ~5M obs 的程序时出现内存不足错误。和 153 个变量。
在 ~40,000 obs 上运行相同的程序时。- 程序执行并完成得很好。当我尝试增加输入 obs 的数量时。超过 100K - 我收到一个错误:内存不足。
我尝试遵循以下提示并取消选中几个框:
1.Tools ► Options ► Results General ► deselect all Result Formats.
2.Tools ► Options ► Results General ► deselect Open generated data/results automatically.
3.Tools ► Options ► Results General ► deselect Link handcoded ODS results.
4.Tools ► Options ► SAS Programs ► deselect Automatically direct results back to SAS Enterprise Guide.
还是行不通。
我使用 Enterprise Guide 5.1,但最终会将工作代码插入到 Data Integration Studio 4.6 上的用户编写代码转换中。
有谁知道如何让这个程序工作?
已编辑
这是导致错误消息的代码段:
data _null_;
set all_include_Stornos ;
IF TREATMENT_IND = 1 AND DDS_ROW_IND NE 1 THEN DO;
CALL EXECUTE ('%STORNO_TKUFA ('||POLICY_RK||');');
CALL EXECUTE ('%UPDATE (STORNO_TKUFA_CUMULATE);');
END;
IF TREATMENT_IND in (4) AND DDS_ROW_IND NE 1 THEN DO;
CALL EXECUTE ('%HAKPAA ('||POLICY_RK||','||POLICY_VERSION||');');
call execute ('%UPDATE(HAKPAA_CUMULATE);');
END;
IF TREATMENT_IND = 5 AND DDS_ROW_IND NE 1 and count_bitul_no <2 or (count_bitul_no >1 and max_bitul_ver = policy_verSion ) THEN DO;
CALL EXECUTE ('%BITUL ('||POLICY_RK||','||POLICY_VERSION||');');
CALL EXECUTE ('%UPDATE(BITUL_CUMULATE);');
END;
IF TREATMENT_IND = 6 AND DDS_ROW_IND NE 1 THEN DO;
CALL EXECUTE ('%LAST_STATE ('||POLICY_RK||','||POLICY_VERSION||');');
CALL EXECUTE ('%UPDATE (LAST_STATE_calc);');
END;
IF DDS_ROW_IND NE 1 and ((PREV_TREATMENT_IND = 4 AND TREATMENT_IND NOT IN (1,2,5)) or treatment_ind = 3) THEN DO;
CALL EXECUTE ('%HAFSHARA ('||POLICY_RK||','||POLICY_VERSION||');');
CALL EXECUTE ('%UPDATE (HAFSHARA_CUMULATE);');
END;
IF TREATMENT_IND = 2 AND POLICY_VERSION - 1 = max_bitul_ver AND DDS_ROW_IND NE 1 THEN DO;
CALL EXECUTE ('%STORNO_BITUL ('||POLICY_RK||','||POLICY_VERSION||');');
CALL EXECUTE ('%UPDATE (STORNO_BITUL_CUMULATE);');
END;
RUN;
这些是在treatment_ind = 5时执行的2个宏(缩短):
%macro BITUL (pol_rk , pol_ver );
proc sql;
create table macro_BITUL
as select * from all_include_Stornos
where policy_rk = &pol_rk
and treatment_ind_5 = &pol_ver
order by policy_rk, policy_version;
quit;
data BITUL_calc;
set macro_BITUL;
BY POLICY_RK;
IF LAST.policy_rk THEN ACT_DAILY_AMT_END_DT = POLICY_VERSION_END_DT;
ELSE ACT_DAILY_AMT_END_DT = NEXT_POLICY_VERSION_START_DT;
VERSION_EXPOSURE_DAYS_NO = ACT_DAILY_AMT_END_DT - ACT_DAILY_AMT_START_DT + 1;
BITUL_DURATION = (POLICY_EXPIRATION_DT_5 - POLICY_VERSION_START_DT + 1) / (POLICY_VERSION_END_DT_5 - POLICY_VERSION_START_DT + 1);
GAINED_NET_PREMIUM_V_AMT = NET_PREMIUM_V_AMT *BITUL_DURATION;
.
.
.
GAINED_NET_COMMISION_B_IB_V_AMT = PRODUCR_B_NET_COMM_IB_V_AMT * BITUL_DURATION;
run;
/**/
PROC SQL;
CREATE TABLE TOTAL_GAINED AS
SELECT POLICY_RK,
SUM(GAINED_NET_PREMIUM_V_AMT) AS TOT_GAINED_NET_PREMIUM_V_AMT,
SUM(GAINED_NET_FEES_V_AMT) AS TOT_GAINED_NET_FEES_V_AMT,
.
.
.
SUM(GAINED_NET_COMMISION_B_IB_V_AMT) AS TOT_GAINED_NET_COMMN_B_IB_V_AMT
FROM BITUL_calc
GROUP BY POLICY_RK;
QUIT;
PROC SQL;
CREATE TABLE BITUL_calc_AND_TOTALS AS
SELECT A.* ,
TOT_GAINED_NET_PREMIUM_V_AMT,
.
.
JOIN TOTAL_GAINED AS B
ON
(A.POLICY_rK = B.POLICY_RK
)order by policy_rk, policy_version;
QUIT;
DATA bitul_CALCULATED;
SET BITUL_calc_AND_TOTALS;
IF TOT_GAINED_NET_PREMIUM_V_AMT = 0 THEN CALCULATED_NET_PREMIUM_V_AMT = 0;
ELSE CALCULATED_NET_PREMIUM_V_AMT = NET_PREMIUM_AMT_5 * GAINED_NET_PREMIUM_V_AMT / TOT_GAINED_NET_PREMIUM_V_AMT;
.
.
ELSE CALC_NET_COMMISION_B_IB_V_AMT = PRODUCR_B_NET_COMM_IB_AMT_5 * GAINED_NET_COMMISION_B_IB_V_AMT / TOT_GAINED_NET_COMMN_B_IB_V_AMT;
.
.
.
.
.
run;
DATA BITUL_CUMULATE;
SET bitul_CALCULATED;
.
.
.
.
.
.
run;
%mend ;
%MACRO UPDATE (TABLE_NAME);
PROC SQL;
DELETE FROM all_include_Stornos
WHERE CATS(POLICY_RK,POLICY_VERSION) IN ( SELECT CATS(POLICY_RK,POLICY_VERSION) FROM &TABLE_NAME);
INSERT INTO all_include_Stornos
select * FROM &TABLE_NAME
;QUIT;
/* PROC SORT DATA=all_include_Stornos OUT=all_include_Stornos; BY POLICY_RK POLICY_VERSION;RUN;*/
%MEND;