LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 28 Jun 2007 07:17:24 -0700
Reply-To:     SK <skauchali@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         SK <skauchali@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Count the proportion of days with exposure in specified time
              period
Comments: To: sas-l@uga.edu
In-Reply-To:  <1183039788.103930.221480@q75g2000hsh.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"

On Jun 28, 4:09 pm, frank_diio...@yahoo.com wrote: > On Jun 28, 9:14 am, SK <skauch...@gmail.com> wrote: > > > > > Hi there, this is a newbie-type question. > > > I have a longitudinal dataset of daily feeding records of infants from > > birth to 270 days (9 months). Infant feeding (category) for the each > > day is recorded at either exclusive breast =1), mixed feeding (=2), > > and exclusive formula (=3). I wish to count the proportion of days a > > child receives either 1, 2 or 3. > > > Data structure and intended variable after manipulation (propfeed): > > > id Feed > > 1 1 > > 1 1 > > 1 2 > > 1 3 > > 2 1 > > 2 1 > > 2 1 > > 2 1 > > 3 3 > > 3 3 > > 3 3 > > etc > > > Desired table: > > id propfeed1 propfeed2 propfeed3 > > 1 0.5 0.25 0.25 > > 2 1.0 0 0 > > 3 0 0 1.0 > > etc. > > > Could someone help guide me through this problem? > > thank you, > > > SK > > Here's an SQL-based solution: > > proc sql noprint; > create table summ as > select sum(feed=1)/count(*) as propFeed1 format=4.2, > sum(feed=2)/count(*) as propFeed2 format=4.2, > sum(feed=3)/count(*) as propFeed3 format=4.2 > from propFeed > group by id > ; > quit;

Thanks Frank. I will try it out and give some feedback on how it goes. Much appreciated. SK


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