First step would be to read the data into a SAS data set. Once you have done that, show us what it looks like and we'll find a way to get rid of those pesky dups.
It looks some thing like this
machine1. Start1. end1. Machine2. Start2. end2. Machine3. Start3. End3
A1. 11/01/15 11:21. 11/01/15 11:38. A1. 11/01/15 11:30 11/01/15 11:35. A1 11/01/15 11:21. 11/01/15 11:38
sometimes there are up to 5 machines but normally there are 3 what I need is to remove the duplicates and keep one of the two....
Thanks
data want;
set have;
array m{*} machine: ;
array s{*} Start: ;
array e{*} end: ;
do i=1 to dim(m);
ma=m{i};
st=s{i};
en=e{i};
output;
end;
drop machine: Start: end: ;
run;
proc sort data=want nodupkey ; by ma st en; run;
data have;
input machine1 $ ( Start1 end1) (& anydtdtm.) Machine2 $ (Start2 end2) (& anydtdtm.) Machine3 $ (Start3 End3) (& anydtdtm.);
format _numeric_ datetime.;
cards;
A1 11/01/15 11:21 11/01/15 11:38 A1 11/01/15 11:30 11/01/15 11:35 A1 11/01/15 11:21 11/01/15 11:38
A1 11/01/15 11:21 11/01/15 11:38 A1 11/01/15 11:30 11/01/15 11:35 A2 11/01/15 11:21 11/01/15 11:38
;
run;
data want;
if _n_ eq 1 then do;
length _machine $ 100 _Start _end 8;
declare hash h();
declare hiter hi('h');
h.definekey('_machine','_Start','_end');
h.definedata('_machine','_Start','_end');
h.definedone();
end;
set have;
array m{*} machine: ;
array s{*} Start: ;
array e{*} end: ;
do i=1 to dim(m);
_machine=m{i};_Start=s{i};_end=e{i};
h.replace();
end;
call missing(of m{*} s{*} e{*});
i=0;
do while(hi.next()=0);
i+1;
m{i}=_machine;s{i}=_Start;e{i}=_end;
end;
h.clear();
drop _: i ;
run;
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.