```Date: Thu, 1 Feb 2007 11:30:03 +1100 Reply-To: "Johnson, David" Sender: "SAS(r) Discussion" From: "Johnson, David" Subject: Re: How to calculate average leads by day Content-Type: text/plain; charset="us-ascii" To quote my namesake: "big picture???". Real estate people may generate most leads on weekends at house openings, sales persons may generate their five days a week from cold calls to business, and so on. I remain unconvinced that a real measure of average leads can be achieved by using the number of calendar days in a month as the denominator. (I presume the leap year would take a little longer to code into the case statement, Art. ) I was also wondering how much data is available, and if it spans more than 12 months then rather than a summary at month level, we may need to summarise to Year * month level, depending on the method employed. Kind regards David -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Arthur Tabachneck Sent: Thursday, 1 February 2007 11:05 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: How to calculate average leads by day 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 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 ************** IMPORTANT MESSAGE ***************************** This e-mail message is intended only for the addressee(s) and contains information which may be confidential. If you are not the intended recipient please advise the sender by return email, do not use or disclose the contents, and delete the message and any attachments from your system. Unless specifically indicated, this email does not constitute formal advice or commitment by the sender or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries. We can be contacted through our web site: commbank.com.au. If you no longer wish to receive commercial electronic messages from us, please reply to this e-mail by typing Unsubscribe in the subject line. ************************************************************** ```

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