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 (August 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 6 Aug 2007 05:22:54 -0000
Reply-To:     hary <hardik617@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         hary <hardik617@GMAIL.COM>
Organization: http://groups.google.com
Subject:      problem sorting dataset (selecting baseline lab value)
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset="iso-8859-1"

Dear all,

I am trying to assign the baseline value of a lab to a variable called baselab.

Here is the dataset

data x; input ptno labnm $ visitno labvalue; cards; 1 ALB 1.00 0.3 1 ALB 1.01 0.2 1 ALB 1.02 . 1 ALB 1.03 0.4 1 ALB 2.00 0.2 1 ALB 2.01 . 1 ALB 2.02 . 1 ALB 2.03 . ; RUN;

In the above example for labtest ALB, for example the labvalue is 0.2 for visit 2. However the rule to select the baseline is as follows:

If there is a value for visit 2 then take this as baseline. however if there is no value at visit 2 then take visit 2.01 as baseline, if we do not have value at visit 2.01 then take 2.02 as baseline, if visit 2.02 value is missing take visit 2.03 as baseline. However if all the visit 2,2.01,2.02,2.03 are missing then take visit 1.03 if not missing as baseline, or else if everything including 2, 2.01,2.02,2.03,1.03 is missing then take 1.02 visit value as baseline, or else if this is missing too then take 1.01 as baseline or else if that is missing take 1.00 as baseline.

Can someone tell me how can i do that?

Thanks in advance.


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