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:         Fri, 1 Sep 2006 14:41:44 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: drug duration
Comments: To: heydon@EMAIL.CHOP.EDU
In-Reply-To:  <200609011337.k81AkcOq010315@mailgw.cc.uga.edu>
Content-Type: text/plain; format=flowed

Data Have ; Infile Cards ; Input DRUG $ DRUGDAY ; Cards ; A 1 A 2 A 3 A 7 A 8 A 9 A 10 B 1 B 2 B 3 ; run ;

Data DefineGroups ( Drop = LastDrugDay ) ; Set Have ; By Drug ;

LastDrugDay = Lag( DrugDay ) ;

If ( First.Drug or ( LastDrugDay ne ( DrugDay - 1 ) ) ) Then Do ; Group + 1 ; Days = 0 ; End ;

Days + 1 ;

Run ;

Proc Sort Data = DefineGroups ; By Drug Group ; Run ;

Data Need ; Set DefineGroups ; By Drug Group ; If Last.Group ; Run ;

Proc Print Data = Need ( Drop = DrugDay ) ; Run ;

Toby Dunn

When everything is coming at you all at once, your in the wrong lane.

A truly happy person is someone who can smile and enjoy the scenery on a detour.

From: Kateri Heydon <heydon@EMAIL.CHOP.EDU> Reply-To: Kateri Heydon <heydon@EMAIL.CHOP.EDU> To: SAS-L@LISTSERV.UGA.EDU Subject: drug duration Date: Fri, 1 Sep 2006 09:37:25 -0400

Hi, I need some help with the following data:

DRUG DRUGDAY A 1 A 2 A 3 A 7 A 8 A 9 B 1 B 2 B 3

How do I create code to determine drug duration by drug? For example, I need the duration for the first three days of A, and then the next 3 days of A. Since there is a break in usage, I want to count this as two separate doses. I know how to count doses and duration if there is no breaks in usage, but where there is, I am very confused. Thanks!


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