Date: Fri, 10 May 2002 14:35:34 -0400
Reply-To: Howard_Schreier@ITA.DOC.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard_Schreier@ITA.DOC.GOV
Subject: Re: Needing some dups, but not others
This is a common enough problem. You need to prepare two (or more) different
summary reports from a dataset.
I would not think in terms of duplicates. Rather, I would look for the
possibility of creating some intermediate summary dataset which in turn can
be used to create all of the needed outputs.
If the initial dataset is large and the intermeidate one is significantly
smaller, this can be worthwhile.
In this case, I presume that CREATED is a date variable, so I would begin by
converting it to month and year:
data unday;
set whatever;
Month = month(Created);
Year = year(Created);
drop Created;
run;
Then use PROC SUMMARY;
proc summary data=unday nway;
class Call_Type Year Month Member_Id;
output out=counts;
run;
From this, both reports can be generated. For example, SQL could be used:
proc sql;
select Year, sum(_freq_) as NumberOfCalls
from counts
group by Year
order by Year;
select Year, Month, count(distinct Member_Id) as NumberOfMembers
from counts
group by Year, Month
order by Year, Month;
quit;
On Fri, 10 May 2002 09:39:34 -0700, Frederick Gibbs <fgibbs@FIRSTLINUX.NET>
wrote:
>Hello-
>
>I have three strands of hair left after this last task and am hoping that
someone can help me:
>
>I am working a data set that involves: Call_Type, Created and Member_Id.
>
>My problem is this: When I am looking at the total number of calls for the
year, I want to include ALL data because I want to know the TOTAL number of
calls (regardless of who made them).
>
>NOW, when I want to look at number of members (unique) members per month, I
want to look at only UNIQUE members for the month, not duplicates (which
would be listed if the same member called several times in one month). He
will need to be included in the following months to be counted as a member,
but I need all duplicate member_id's removed from the month.
>
>Any ideas? I appreciate any and all assistance.
>
>Thanks-
>
>Fritz
>
>_____________________________________________________________
>Want a new web-based email account ? ---> http://www.firstlinux.net
>
>_____________________________________________________________
>Promote your group and strengthen ties to your members with
email@yourgroup.org by Everyone.net http://www.everyone.net/?btn=tag