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 (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 7 Sep 2006 16:51:02 -0400
Reply-To:   Peter Constantinidis <peter@CONSTANTINIDIS.CA>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Peter Constantinidis <peter@CONSTANTINIDIS.CA>
Subject:   Re: Trying to figure out the best way to count unique observations by variable in a dataset
In-Reply-To:   <7ffd0c20609071321k7c01bae2w8bad0aeb7049a934@mail.gmail.com>
Content-Type:   text/plain; charset=ISO-8859-1; format=flowed

I found code on the web that helps, it will produce 14 observations in a data set, but it creates a data set.. :( So I would still have to merge stuff together? so it could be counted as part of proc summary, or the like? And still have to make a data set for each leave code?

data testing; set perm.f20032004 (rename=( actualhrs=actlhrs leavecd=leave_code)); where leave_code='952'; by emplid Leave_code; * reset score at each change of recno; if first.emplid then score = 0; * increment score at each change in comp, except when comp=0; if first.leave_code and leave_code <> 0 then score + 1; * output the accumulate score before the next change in recno; if last.emplid then output;

run;

data testing2;

do until (last.emplid) ; set perm.f20032004 (rename=( actualhrs=actlhrs leavecd=leave_code));where leave_code='952'; by emplid leave_code ; score = sum (last.emplid) ; end ; run ;


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