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 out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.