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 (June 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 7 Jun 2005 13:35:22 -0400
Reply-To:     BJ Mattson <bmattson@ODH.OHIO.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         BJ Mattson <bmattson@ODH.OHIO.GOV>
Subject:      Re: Help with Coding

On Tue, 7 Jun 2005 08:12:17 -0700, prasad_prabhud@HOTMAIL.COM wrote:

>I have following Patient Data with 5 months of data with 100mg drug, >150mg drug and 200mg drug. > > ID A100_1 A100_2 A100_3 A100_4 A100_5 A150_1 A150_2 A150_3 A150_4 >A150_5 A200_1 A200_2 A200_3 A200_4 A200_5 >100 1 0 0 0 0 0 1 1 1 0 > 0 0 0 0 1 >101 0 0 1 1 1 0 0 0 0 0 > 0 0 0 0 0 >102 1 1 0 0 0 0 0 0 0 0 > 0 0 1 1 1 >103 0 0 0 1 0 0 0 0 0 1 > 0 0 0 0 0 >104 1 1 1 0 0 0 0 0 0 0 > 0 0 0 1 1 > >What I want is the Pattern in which Patient has been on Drugs? >Like Patient started with 100mg and has been on 100mg drug throughout 5 >months or Patient started with different mg drug and then continued >with 100mg drug. > >I would appreciate if anybody can help me in this.

_If_ what you need is 1 variable with the dose pattern within it, this could work. The result is a single variable with the doses separated by 1 space, left justified in the field. It could be subdivided later, if need be.

BJ Mattson Note: I compressed your data to stop it from wrapping.

************************************************************************** proc format; value A100_ 1 = "A100 " 0 = " "; value A150_ 1 = "A150 " 0 = " "; value A200_ 1 = "A200 " 0 = " "; run; data work.drug; input ID A100_1 A100_2 A100_3 A100_4 A100_5 A150_1 A150_2 A150_3 A150_4 A150_5 A200_1 A200_2 A200_3 A200_4 A200_5 ; pattern = left(compbl(cat( put(A100_1,A100_.),put(A100_2,A100_.),put(A100_3,A100_.), put(A100_4,A100_.),put(A100_5,A100_.), put(A150_1,A150_.),put(A150_2,A150_.),put(A150_3,A150_.), put(A150_4,A150_.),put(A150_5,A150_.), put(A200_1,A200_.),put(A200_2,A200_.),put(A200_3,A200_.), put(A200_4,A200_.),put(A200_5,A200_.) ))); datalines; 100 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 101 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 102 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 103 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 104 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 ;;;; run; proc print; var pattern; run;


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