LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 31 Jan 2007 19:05:02 -0500
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: How to calculate average leads by day
Comments: To: Dave Fickbohm <davefickbohm@YAHOO.COM>

Dave,

I don't have time to test this right now, but would something like the following meet your needs:

data have; input create_dt ddmmyy8. monthdt ctr; cards; 01/10/06 10 1 01/10/06 10 1 02/10/06 10 1 31/10/06 10 1 01/11/06 11 1 02/11/06 11 1 02/11/06 11 1 30/11/06 11 1 01/12/06 12 1 31/12/06 12 1 ; run; proc sql; select monthdt as month, sum(ctr) as total, case when month in (1,3,5,7,8,10,12) then sum(ctr)/31 when month in (4,6,9,11) then sum(ctr)/30 else sum(ctr)/28 end as average_leads_per_day from have; quit;

Art ----- On Wed, 31 Jan 2007 15:38:05 -0800, David Fickbohm <davefickbohm@YAHOO.COM> wrote:

>People, I have a datafile that includes create_dt monthdt and ctr create_dt monthdt ctr 01/10/06 10 1 01/10/06 10 1 02/10/06 10 1 . . . 31/10/06 10 1 01/11/06 11 1 02/11/06 11 1 02/11/06 11 1 . . . 30/11/06 11 1 01/12/06 12 1 . . . 31/12/06 12 1

I want to sum the ctr and divide by the number of days in each month. desired output month total average leads per day 10 62 2 11 90 3 12 81 2.6

Your suggestions would be appreciated. Thanks Dave

Dave Fickbohm


Back to: Top of message | Previous page | Main SAS-L page