Have added the following code that gets me the same day repeat Persons. data test2;
set test;
Where date = '05Nov2018'd;
run;
proc sql;
Create table testCallPersons as
Select Date, Person, count(person) as personcount
From (select distinct date, Person from Test2)
Group by Date, Person;
quit;
proc Summary data=testCallPersons;
By Date;
VAr personcount;
Output out=testPCount (Drop=_freq_ _Type_) sum=;
run;
proc sql;
Create table testCallCount as
Select Date, Person, count(person) as Callcount
From (select date, Person from Test2)
Group by Date, Person;
quit;
Data TestDupPerscount;
Set testCallCount;
If Callcount >1 Then
DupCount = 2;
Else DupCount = 1;
run;
proc Summary data=TestDupPerscount;
By Date;
VAr Callcount DupCount;
Output out=testCCount (Drop=_freq_ _Type_) sum=;
run;
Data testMerge;
Merge testPCount testCCount;
By Date;
run;
Data testPerc;
Drop personcount Callcount DupCount;
Set testmerge;
Day1Perc = (DupCount - personcount) / personcount;
format Day1perc percent7.2;
run; Anyway of doing this smarter? Just now need to work out how to match against the previous days to get the duplicates. Cheers Dean
... View more