- data source;
- input str:$20.;
- datalines;
- ABCDE
- ABR
- BG
- BCD
- CE
- BR
- DR
- EFGR
- ER
- CD
- AK
- ;
- run;
- data t1;
- set source;
- id+1;
- do i=1 to length(str) by 1;
- kw=substr(str,i,1);
- output;
- end;
- drop i;
- run;
- proc sql;
- create table R(drop=id) as
- select
- id
- ,str
- from (
- select
- a.id
- ,a.str
- ,b.id as id1
- ,sum(case when missing(b.kw) then 0 else 1 end) as sum
- ,length(a.str) as len
- from t1 a
- left join t1 b
- on a.kw=b.kw
- and a.id>b.id
- group by
- a.id
- ,a.str
- ,b.id
- ) c
- group by id,str
- having sum(case when sum=len then 1 else 0 end)=0
- ;
- quit;


雷达卡


京公网安备 11010802022788号







