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 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 22 Aug 2008 09:06:23 -0500
Reply-To:   Mary <mlhoward@avalon.net>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Mary <mlhoward@AVALON.NET>
Subject:   Re: how to copy a row
Comments:   To: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Content-Type:   text/plain; charset="iso-8859-1"

And what would your view of "normalizing the data" look like? This data does look normalized to me- you wouldn't want data to be variables like patid, visit, variable name, value, since variables have values of substantially different types and ranges of values, like a visit would be an integer, a strength would be a MG value like 20MG, a number of tabs would be an integer, like 2 tabs per day, a weight would be a value perhaps with a decimal, and a height might have a decimal as well, whereas the name of the drug might be something like "Prozac" and be character. Thus, having variables across **does** seem to be appropriate normalization for data like this, and does not seem to be difficult to deal with in "carrying forward" previous values.

Yes, each variable should be carried forward individually; certainly missing character variables and missing numeric variables could not be combined in the same array, like this:

do i=1 to dim(vararray);

a=lag(vararray(i));

if vararray(i)=' ' and not first.visit then vararray(i)=a;

end;

drop i a;

run;

But this code could be done on groups of variables with the same type that are variables that make sense to carry forward values, by specifying the variables desired in the array and either missing or space in the IF condition depending on the variable type.

-Mary

----- Original Message ----- From: ./ ADD NAME=Data _null_, To: SAS-L@LISTSERV.UGA.EDU Sent: Friday, August 22, 2008 7:00 AM Subject: Re: how to copy a row

It should also be pointed out that the example of carrying for an entire observation as the OP asked for and as provided by my example, (which suites the sample but not the real world, it wont work with two or more missing visits) is not the "accepted" LOCF technique.

The missing pattern is rarely "complete" across and entire observation. A more general solution would involve carrying forward each variable individually. This is easily accomplished by normalizing the data. Makes the code much simpler, too.

There are many examples on SAS-L and in SUG papers.

On 8/21/08, Lou <lpogoda@verizon.net> wrote: > "Kevin Viel" <citam.sasl@GMAIL.COM> wrote in message > news:200808212013.m7LGKBff032286@malibu.cc.uga.edu... > > On Mon, 18 Aug 2008 08:50:11 -0700, pausha <pausha1@GMAIL.COM> wrote: > > > > >i have this strangle condition and need some help > > >I have a dataset with patients who visit every week ,say if they miss > > >a week i still have to have their data copied form previous week for > > >that missed one. > > >eg > > > > > >pat-id visit adm dose wt > > > > > >001 1 52 32 78 > > >001 2 25 54 78 > > >001 3 . . . > > >002 1 56 54 90 > > >002 2 . . . > > > > > >in this case i would have to have the previous row copied to the > > >visits that is missing > > >help with logic to populate the whole row > > > > > >i have 40 variables in a row. > > > > I have not read through any but one of the responses, so I hope that I am > > not duplicating my warning. No, check that, I hope I am repeating it. > > > > I would strongly advise against this. You could bias your results. > > Perhaps wt (weight) does not change from visit to visit (or more), but > > other things may. > > > > In a clinical trials setting, it's pretty common to do analyses on a "last > observation carried forward" basis to fill in missing data in addition to > having analyses based solely on the data collected. Any tables generated on > an LOCF basis are so labeled. >


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