Date: Fri, 31 Aug 2007 13:29:33 -0000
Reply-To: sassql@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: sassql@GMAIL.COM
Organization: http://groups.google.com
Subject: Re: derive variables for dataset (urgent)
In-Reply-To: <1188540720.806092.260650@q3g2000prf.googlegroups.com>
Content-Type: text/plain; charset="utf-8"
On Aug 31, 2:12Â am, RolandRB <rolandbe...@hotmail.com> wrote:
> On 31 Aug, 02:57, sas...@gmail.com wrote:
>
>
>
>
>
> > Dear all,
>
> > I am assigned to create a dataset and it has few variables that i need
> > to derive but i am not quite sure how i would do that. Any help would
> > really be appreciated.
>
> > Variable to be derived is x.
>
> > Procedure:
>
> > This is to be created for visits 1-6. If a subject has one record for
> > a value of visit set x=1 for that record.
>
> > If subject has multiple records for a value of visit, set x=1 for the
> > record where dayofstudy is closest to plannedday (see below).
> > If the assessments were performed the same distance from plannedday,
> > set x=1 for the record where dayofstudy > plannedday.
>
> > visit variable is derived using following information:
>
> > = -1 if .z < dayofstudy< -4
> > = 0 if -4 ≤ dayofstudy ≤ 0
> > = 1 if 1 ≤ dayofstudy ≤ 10
> > = 2 if 11 ≤ dayofstudy ≤ 17
> > = 3 if 18 ≤ dayofstudy ≤ 24
> > = 4 if 25 ≤ dayofstudy ≤ 34
> > = 5 if 35 ≤ dayofstudy ≤ 48
> > = 6 if 49 ≤dayofstudy ≤ 59
>
> > Plannedday is defined for each visit as follows:
> > visit=1: plannedday=7
> > visit=2: plannedday=14
> > visit=3: plannedday=21
> > visit=4: plannedday=28
> > visit=5: plannedday=42
> > visit=6: plannedday=56
>
> > The dayofstudy for a patient 101 looks something like this:
>
> > ptno  dayofstudy
> > 101 Â Â Â Â -7
> > 101 Â Â Â Â -1
> > 101 Â Â Â Â 7
> > 101 Â Â Â Â 14
> > 101 Â Â Â Â 21
> > 101 Â Â Â Â 28.
>
> > Can someone tell me how should i derive the flag x as per the
> > specifications given above?
>
> > I would appreciate your help.
>
> > Regards,
>
> I have done this in the past and it is easy. Set up a variable (I'll
> call it "abs") that contains the absolute difference between the
> actual day and the planned day. Next sort into visit abs descending
> dayofstudy order. The first record in each visit group will be the one
> you want so set the flag for "if first.visit".- Hide quoted text -
>
> - Show quoted text -
Hi Roland,
I tried doing that but this is what is happening. The below example is
after sorting it as you said. However i dont want to flag the
first.visit record, i want to flag the second record because in the
situation where there are multiple records per visit, flag the record
where dayofstudy>plannedday.
Can you suggest how can i do that?
For instance:
visit abs dayofstudy plannedday
1 -6 1 7
1 2 9 7
|