这是我正在使用的数据.......
data fac1;
infile datalines dlm='|';
input fac_nm :$32. onesrc_fac_id D3_fac_id tms_fac_id;
datalines;
Kouzzina by Cat Cora|349059|108176|54
Be Our Guest Restaurant|16660079|112861|61
Club 33|354189|110798|0
Blue Bayou|354099|109593|0
;
run;
这是代码......
proc sort data=fac1 out=fac; by D3_fac_id;run;
data ctrl;
set fac(rename=(D3_fac_id=start onesrc_fac_id=label )) end=last;
retain fmtname 'facid' type 'n';
if start ne .;
output;
if last then do;
hlo='O';
label=.;
output;
end;
run;
proc format library=work cntlin=ctrl;
run;
输出:------- 这是我用于格式化的代码......
data want;
set fac1;
fac_id_char=put(D3_fac_id, facid.);
run;
它给了我最后2行的缺失值.....