SAS 数据集批量拆分
数据量比较大时,需要拆分数据集,再批量计算执行;
数据简单描述:多个cell_phone,每条cell_phone 对应多条other_cell_phone,需要大致均等拆分10份
%INCLUDE "..\00@Common\01@header\01@Header.sas";
PROC SORT DATA =S1.COM_03 OUT=COM_03;
BY CELL_PHONE;
RUN;
DATA S1.Split_03_1(DROP=ID) S1.Split_03_2(DROP=ID) S1.Split_03_3(DROP=ID) S1.Split_03_4(DROP=ID) S1.Split_03_5(DROP=ID)
S1.Split_03_6(DROP=ID) S1.Split_03_7(DROP=ID) S1.Split_03_8(DROP=ID) S1.Split_03_9(DROP=ID) S1.Split_03_10(DROP=ID);
SET COM_03;
BY CELL_PHONE;
IF _N_=1 THEN ID=1;
RETAIN ID;
IF LAST.CELL_PHONE THEN ID+1;
IF ID<=60 THEN OUTPUT S1.Split_03_1;
ELSE IF 60<ID<=120 THEN OUTPUT S1.Split_03_2;
ELSE IF 120<ID<=180 THEN OUTPUT S1.Split_03_3;
ELSE IF 180<ID<=240 THEN OUTPUT S1.Split_03_4;
ELSE IF 240<ID<=300 THEN OUTPUT S1.Split_03_5;
ELSE IF 300<ID<=360 THEN OUTPUT S1.Split_03_6;
ELSE IF 360<ID<=420 THEN OUTPUT S1.Split_03_7;
ELSE IF 420<ID<=480 THEN OUTPUT S1.Split_03_8;
ELSE IF 480<ID<=540 THEN OUTPUT S1.Split_03_9;
ELSE OUTPUT S1.Split_03_10;
RUN;