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 (August 1998, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 12 Aug 1998 02:55:15 +0200
Reply-To:     Lutz Hoffmann <Lutz@DOLMEN.IN-BERLIN.DE>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Lutz Hoffmann <Lutz@DOLMEN.IN-BERLIN.DE>
Organization: Individual Network Berlin e.V.
Subject:      Re: 1000 employes......18000 obs
Content-Type: text/html; charset=us-ascii

<HTML> Steve Corson wrote: <BLOCKQUOTE TYPE=CITE>I have a DataSet which contains daily hours of work <BR>for approximatly 1000 employes. The DataSet contains <BR>one month of work. Some employes worked 20 days, <BR>others worked 15, 16 days...it varies. The size of the <BR>DataSet is around 18000 observations.

<P>One observation consists of 3 variables.

<P>For example, <BR>the date of work (98-08-10), the employe ID <BR>(c23452) and the number of hours for that day <BR>(8.00) in time5.2 format.

<P>What I would need is a new dataset that would give <BR>me the following:

<P>- employe ID <BR>- number of days of work in a month <BR>- total of hours of work in a month

<P>So the number of observations would equal the number <BR>of employes.

<P>Can anyone help ?</BLOCKQUOTE> Hi Steve,

<P>Bruce is right. Anyway, try this (untested) code:

<P>proc univariate data= &lt;your-data-set> noprint; <BR>&nbsp; var &lt;time>; <BR>&nbsp; by&nbsp; &lt;id> &lt;date>; <BR>&nbsp; output out= uni1 <BR>&nbsp;&nbsp;&nbsp;&nbsp; sum= sum_time; <BR>run;

<P>proc univariate data= uni1 noprint; <BR>&nbsp; var date sum_time; <BR>&nbsp; by&nbsp; &lt;id>; <BR>&nbsp; output out= uni2 <BR>&nbsp;&nbsp;&nbsp;&nbsp; n=&nbsp; n_date dummy1 <BR>&nbsp;&nbsp;&nbsp;&nbsp; sum= dummy2 sum_time; <BR>run;

<P>data &lt;final-name>; <BR>&nbsp; set uni1 (keep= &lt;id> n_date sum_time); <BR>run; <BR>&nbsp;

<P>Hope this helps <BR>Lutz</HTML>


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