| Date: | Sat, 1 Sep 2007 18:57:28 -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: LOCF question |
|
| In-Reply-To: | <1188641249.289882.327210@r29g2000hsg.googlegroups.com> |
| Content-Type: | text/plain; charset="us-ascii" |
|---|
On Sep 1, 6:07 am, "cat.." <cat....@gmail.com> wrote:
> Hi!
>
> I would try this:
>
> proc sort data = example; by pt visit;
>
> data locf;
> set example;
> by pt visit;
> pvisit = lag(visit);
> plabstd = lag(labstd);
> if not first.pt then do;
> if visit ne pvisit + 1 then do;
> visit = pvisit + 1;
> labstd = plabstd;
> output;
> end;
> end;
> drop pvisit plabstd;
> run;
>
> but cannot test it.
>
> Regards,
>
> Catherine.
>
> On Aug 31, 7:42 pm, sas...@gmail.com wrote:
>
> > Dear,
>
> > Say for example if i am having 6 visits per patient, and i want to
> > determine if any patient is missing any visit out of this 6, then i
> > have to create an extra record for the missing visit, then how should
> > i do that? Also i need to do a LOCF from the previous visit if the
> > current visit is missing.
>
> > Example
> > PT visit labstd
> > 101 1 0.1
> > 101 2 0.1
> > 101 3 0.1
> > 101 5 0.1
> > 101 6 0.1
>
> > If in the above example say visit 4 is missing, then i have to carry
> > over all the data from the previous visit 3. Can someone tell me how
> > can i do that?
>
> > Regards,
Hi,
Actually i have a data with around 100+ variables in it. And i need to
make sure that there should be atleast 6 visits per patient. So if in
case a patient is missing any visit, then i need to create a visit
which is missing and then carry over the data from the previous visit
for all the variables except few variables. I have two variables in
the dataset named flag and ontreatment. So if a patient is missing any
visit, i have to create a record for the missing visit, and carry over
all the data from the previous visit for most of the variables, only
where flag = 1 and ontreatment = 1.
Example:
Patient visit FLAG ontreatment ecogscore OC_LOCF tumormeasurements
investi daysofstudy plannedday
101 -1 3 OC 20
101 0 2 OC 20
101 1 1 1 4
OC 30
101 1 1 3 OC 30
101 2 1 1 4
LOCF .
101 3 1 1 2
OC 34
101 4 1 1 2
LOCF .
101 5 1 1 2
LOCF .
101 6 1 1 2
LOCF .
So there are character and numeric variables both in the dataset whose
value needs to be carry over. In the above example, for patient 101,
its missing visit 2, 4 5 and6. So i have to carry over data from the
visit 1 for visit 2 where flag = 1and ontreatment = 1 for all the
variables except the tumormeasurements. For visit 4, 5 and 6, carry
over the data from the visit 3 where flag = 1 and ontreatment = 1 for
all variables except the tumor measurements. That's the reason the
tumor measurements values are missing for the LOCF records.
I would really appreciate if you can let me know how i can implement
the above LOCF. Just want to remind again that there are more than 100
variables in the dataset and they are both character and numeric.
Regards,
|