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 (March 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 24 Mar 2009 19:49:23 -0400
Reply-To:     Seth StJames <sethstjames@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Seth StJames <sethstjames@GMAIL.COM>
Subject:      Re: LOCF help
Comments: To: Kannan Murugaiyan <kannan.murugaiyan@yahoo.co.in>
In-Reply-To:  <200903241118.n2OAlXiY019378@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1

Then I quess you're after something like the code below. If so then perhaps we can find an easier way to do it (maybe something like do until ... set dataset point= ... or something like that). But regarding the demographic vars, it's an easy process to merge or sql them in once your LOCF routine is correct.

data labs; input subject $ parameter visit value; datalines; 101 1 1 20 101 1 3 12 101 1 4 21 101 1 5 2 101 2 1 11 101 2 3 11 101 2 5 15 101 3 4 10 102 1 2 18 102 1 3 5 102 1 4 17 102 2 4 22 102 3 1 16 102 3 6 7 ; run;

proc sort data=labs; by subject parameter visit; run;

proc sql feedback; create table distinct_subject_parms as select distinct subject, parameter from labs;

create table distinct_visits as select distinct visit from labs;

create table template as select * from distinct_subject_parms, distinct_visits order by subject, parameter, visit; quit;

data temp_labs; retain id 0; merge template labs(in=b keep=subject parameter visit); by subject parameter visit; if first.parameter then id=0; if b then id=id+1; run;

data lab_ids; retain id 0; set labs; by subject parameter; if first.parameter then id=0; id=id+1; run;

proc sort data=lab_ids; by subject parameter id; run;

proc sort data=temp_labs; by subject parameter id; run;

data events(keep=sub: par: vis: val:); merge lab_ids temp_labs; by subject parameter id; if nmiss(value) then delete; run;

options byline;

proc print; by subject parameter; var visit value; run;

On Tue, Mar 24, 2009 at 7:18 AM, Kannan Murugaiyan < kannan.murugaiyan@yahoo.co.in> wrote:

> On Mon, 23 Mar 2009 22:27:40 -0400, Bob LaRue <bjlarue@SBCGLOBAL.NET> > wrote: > > >Seth, > > > >I believe he wants to make new observations in cases where an expected > >observation does not exist. For example, if a parameter is expected at > >visits 1 thru 8 and no observation exists for visit 6, then you might want > >to create a new observation for visit 6 and fill in all the pertinent > >information for that subject by getting it from the previous existing > >record. We do that in my office but usually not with so many variables to > >fill in. Hope this helps. > > > >Regards, > > > >Bob > > Hi Venkat, > > Take all the unique variables from the demog dataset and another > dataset with only one variable with all possible visits(visti 1 to visit > 6) and merge these two datasets in proc sql, without any conditions. then > finally you merge with the original one for example vital. for that you > have to use patno and visit as unique variable. this will be suitable for > Bob's reply. > > Regards, > Kannan.M > Quartesian Clinical Research, > Bangalore,India. >


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