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= <your-data-set> noprint;
<BR> var <time>;
<BR> by <id> <date>;
<BR> output out= uni1
<BR> sum= sum_time;
<BR>run;
<P>proc univariate data= uni1 noprint;
<BR> var date sum_time;
<BR> by <id>;
<BR> output out= uni2
<BR> n= n_date dummy1
<BR> sum= dummy2 sum_time;
<BR>run;
<P>data <final-name>;
<BR> set uni1 (keep= <id> n_date sum_time);
<BR>run;
<BR>
<P>Hope this helps
<BR>Lutz</HTML>