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 (April 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 11 Apr 2002 10:47:07 -0400
Reply-To:     "Shilling, Brian" <Brian.Shilling@ASTRAZENECA.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Shilling, Brian" <Brian.Shilling@ASTRAZENECA.COM>
Subject:      Re: making episodes
Comments: To: Robert Virgile <virgile@ATTBI.COM>
Content-Type: text/plain; charset="iso-8859-1"

Don't forget to RETAIN result; to keep it on every record.

Bri

-----Original Message----- From: Robert Virgile [mailto:virgile@ATTBI.COM] Sent: Thursday, April 11, 2002 10:35 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: making episodes

It's easy, assuming your data is sorted by ID:

data new; set old; by ID; if first.ID then result + 1; run;

In the documentation, read about two related topics: (1) a sum statement (NOT the sum function), and (2) the by statement in a data step.

Good luck.

Bob V.

-----Original Message----- From: Wim Goettsch <wim.goettsch@PHARMO.NL> Newsgroups: bit.listserv.sas-l To: SAS-L@LISTSERV.UGA.EDU <SAS-L@LISTSERV.UGA.EDU> Date: Thursday, April 11, 2002 10:20 AM Subject: making episodes

>To sas_L > >I have a simple question but I do not know how to solve: > >Dataset: > >ID score >A 0 >A 1 >A 1 >B 0 >C 0 >C 1 >C 1 >C 0 >C 1 >D 0 > >0 is start period, last 1 is end of period. > >I would like to have this result; > >ID score result >A 0 1 >A 1 1 >A 1 1 >B 0 2 >C 0 3 >C 1 3 >C 1 3 >C 0 4 >C 1 4 >D 0 5 > >What is the solution? > >Thanks, > >Wim Goettsch, PhD >Research Manager >PHARMO >Institute for Pharmacoepidemiology and Drug Outcomes Research >Maliebaan 50 >P.O. Box 85222 >3508 AE Utrecht, The Netherlands >Telephone: +31(0)302345743 >Fax: +31(0)302345568 >Mobile: +31(0)654776074 >E-mail: wim.goettsch@pharmo.nl


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