|
A data step view, CALL SORTC and NODUPKEY. I changed the data type
for IDn. Seems like ID would/should be character.
data have;
input (id1 id2)(:$4.) dist;
cards;
1067 1067 0
1067 1069 2
1067 1097 5
1069 1067 2
1097 1067 5
1154 1156 5
;;;;
run;
data haveV / view=haveV;
set have;
where dist gt 0;
call sortC(id1,id2);
run;
proc sort data=haveV out=need nodupkey;
by id:;
run;
proc print;
run;
On 4/20/09, POHL, Dr., Stefan - AKTUARE <pohl@aktuare.de> wrote:
> Dear list/ SAS-learner,
>
> suppose I have this data set:
>
> data have;
> input id1 id2 dist;
> cards;
>
> 1067 1067 0
> 1067 1069 2
> 1067 1097 5
> 1069 1067 2
> 1097 1067 5
> 1154 1156 5
> ;;;;;
> run;
>
> I want to get this data, i.e. I want to delete cases like 1069 1067 as this
> is the same case as 1067 1069 with the same distance:
>
> id1 id2 dist
> 1067 1069 2
> 1067 1097 5
> 1154 1156 5
>
> How can I solve my problem?
>
> Stefan.
>
|