METHOD1
/*存储宏*/
OPTIONS SASMSTORE=SASUSER MSTORED MAUTOSOURCE;
%MACRO DATASET_BID_SORT(input_table,by_var,output_table)/STORE;
PROC SORT DATA=&input_tableOUT=&output_table;
BY &by_var;
%MEND;
/*调用宏*/
LIBNAME S '.';
OPTIONS SASMSTORE=SASUSER MSTORED MAUTOSOURCE;
%DATASET_BID_SORT(S.final,BID0,S.BID);
METHOD2
/*宏,放在MACRO_BID_SORT.sas文件下*/
%MACRO DATASET_BID_SORT(input_table,by_var,output_table);
DATA temp1;
SET &input_table;
IF w1>80;
RUN;
DATA temp2(DROP=R I);
SET temp1;
LENGTH BID0 $12 R $6 I $6;
R=FLOOR(RANUNI(123)*899999+100000);
I=100000+_N_;
BID0=CATS(R,I);
RUN;
PROC SORT DATA=temp2 OUT=&output_table;
BY &by_var;
%