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 (October 2011, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 3 Oct 2011 16:00:52 -0400
Reply-To:   Kim Brown <kibrown@LADHS.ORG>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Kim Brown <kibrown@LADHS.ORG>
Subject:   Counting & Reporting by Week by Site

Hi All, proc format; value weekdayname 1='Sunday' 2='Monday' 3='Tuesday' 4='Wednesday' 5='Thursday' 6='Friday' 7='Saturday'; run;

data have; input adm_date $10. days$ siteid $ status $ d_timestamp $18.; cards; 9/28/2011Wednesday 1 Enrolled 28SEP2011:09:30:30 9/29/2011 Thursday 1 Review 29SEP2011:16:28:14 9/28/2011Wednesday 1 Review 28SEP2011:17:39:53 9/28/2011Wednesday 1 Review 28SEP2011:16:49:16 9/29/2011Thursday 1 Review 29SEP2011:16:31:57 9/28/2011Wednesday 1 Review 28SEP2011:09:54:54 9/28/2011Wednesday 1 Review 28SEP2011:17:03:02 9/28/2011Wednesday 1 Review 28SEP2011:17:51:02 7/21/2011Thursday 2 Enrolled 21JUL2011:15:46:00 8/20/2011Saturday 2 Enrolled 20AUG2011:14:55:29 7/6/2011 Wednesday 2 Enrolled 06JUL2011:10:21:42 9/1/2011 Thursday 2 Enrolled 01SEP2011:13:55:05 8/10/2011 Wednesday 2 Enrolled 10AUG2011:16:09:30 9/16/2011 Friday 2 Enrolled 16SEP2011:08:00:48 9/16/2011 Friday 2 Enrolled 16SEP2011:08:25:58 9/9/2011 Friday 2 Enrolled 09SEP2011:13:31:38 8/10/2011 Wednesday 2 Enrolled 10AUG2011:15:12:57 9/10/2011 Saturday 2 Enrolled 10SEP2011:07:42:28 9/14/2011Wednesday 2 Enrolled 14SEP2011:10:11:31 9/9/2011Friday 2 Enrolled 09SEP2011:10:07:31 9/2/2011Friday 2 Enrolled 02SEP2011:15:19:09 7/13/2011Wednesday 2 Enrolled 13JUL2011:15:58:58 9/2/2011Friday 2 Enrolled 02SEP2011:16:50:15 9/14/2011Wednesday 2 Enrolled 14SEP2011:10:37:07 7/21/2011Thursday 2 Enrolled 21JUL2011:15:00:26 9/2/2011 Friday 2 Enrolled 02SEP2011:15:41:56 7/8/2011Friday 2 Enrolled 08JUL2011:09:31:25 ; run;

Proc sort data=have ; by siteid status d_timestamp ; run;

* criteria - Monday thru sunday is a week.; data want; format date1 mmddyy10. days WeekDayName. ; set have; startdate='01jul2011:00:00:00'dt ; reportdate=intnx('week.7',messagetimestamp,0) ; date1=datepart(messagetimestamp); days=weekday(date1) ; /*week=intck('week.7',startdate,)-1 ; */

run;

proc transpose data=want out=want2 (drop = _: ) ; by siteid3; id hwlastatusdesc; var count; run; *90;

*Is there a way to group by week (I want Monday thru sunday), then count by status and siteid I'm trying to avoid manually coding the week, then running a frequency to count and then using a transpose for each week and then set all weeks to together because all those steps seem messy every week; *Want this output: ;

*September 12-18 count by siteid3 Enrolled Review ; 4 0

Any suggestions would be appreciated. Thanks, Kim


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