/* macro extunique */
%macro extunique(Dsin,idvar,dsout,dspup);
/* extract the id's only to speed calculations*/
data temp_allids;
set &dsin;
keep &idvar;
run;
/*extract the id's with count>1*/
data temp_nid;
set temp_uid;
if _count>1 then output;
keep &idvar;
run;
/*sort the data using idvar and output only one row per
idvar value*/
proc sort data=&sin;
by &idvar;
run;
data &dsout;
set &dsin;
by &idvar;
if fitst.&idvar;
run;
/*extract the full records for the repeates id's*/
proc sql noprint;
create table &dsdup as select b.*from temp_nid a,&dsin b
where a.&idvar=b.&idvar;
run;
quit;
/*clean the workspace*/
proc datasets nodetails nolist;
delete temp_allids temp_uid temp_nid;
run;
quit;
%mend;
data mv;
input id balance @@;
datalines;
01 1223 01 2322 02 344 02 21221
03 2334 04 222 05 222 06 222
;
run;
%let idvar=id;
%let dsin=mv;
%let dsout=mv_id;
%let dsdup=duplicate_id;
%extunique(&dsin,&idvar,&dsout,&dsdup);
set temp_uid; 书中后面给了个宏,但是这个表是从哪来的???执行也是错误
ERROR: 文件“WORK.TEMP_UID.DATA”不存在。