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 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 16 Jun 2003 00:08:31 GMT
Reply-To:     julierog@ix.netcom.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Roger Lustig <trovato@BELLATLANTIC.NET>
Subject:      Re: counting the survivor
Content-Type: text/plain; charset=us-ascii; format=flowed

Dear Christian:

This should work in V8. For V6, shorten the variable names.

proc sort data=people; by name firm year; run;

data survivors (keep=start until:); array until (1998:2003) until_1998-until_2003; do until (last.firm); set people; by name firm; if first.firm then start=year; until(year)=1; end; run;

proc summary nway; class start; var until:; output out=totals sum=; run;

proc print data=totals noobs; var start until:; run;

OK?

Roger

Christian wrote: > Hi everyone! > > I don't know how to count the surviving names in my dataset. I have a > list of names with the firms they are working in over many years. It > looks like this > > Name firm year > John Smith A 1998 > Carl Peters A 1998 > Joe Sims B 1998 > John Smith B 1998 > > John Smith A 1999 > George Ley A 1999 > Dan Bird B 1999 > Joe Sims B 1999 > > In this example there are 4 names in 1998. Two names John Smith in > firm A and Joe Sims in firm B survive to 1999. The result would then > look like this: > > Until 1998 1999 > Start > 1998 4 2 > > Is there a way to reach this result? Any idea on how to approach this > is greatly appreciated. > Christian


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