LOCF coding check continued..

Reply
N/A
Posts: 0

LOCF coding check continued..

the rest of the coding is ...

*** if labvalue is within 5 days of dosing,retain it as a valid baseline.;
if 1 <=(dosedate-sampdate)<=5 then
do i = 1 to 3 ;
if chol{i} ne . then
base{i} = chol{i};
end;
*** keep last record per patient holding the locf values.;
if last.subject;
label b_hdl="baseline hdl"
b_ldl="baseline ldl"
b_trig="baseline triglycerides";
run;

thanx
April.
N/A
Posts: 0

Re: LOCF coding check continued..

I hope I have understood your problem correctly. I have slightly modified the code.

*** Input Sample cholesterol data;
***subject=patient number,sampdate=lab sample date,
***HDL=HDL,LDL=LDL,TRIG=Triglycerides.;
data cholesterol_base;
input subject $ sampdate date9. hdl ldl trig;
cards;
101 05sep2003 48 188 108
101 06sep2003 49 185 .
102 01oct2003 54 200 350
102 02oct2003 52 . 360
103 10nov2003 . 240 900
103 11nov2003 30 . 880
103 12nov2003 32 . .
103 13nov2003 35 289 930
;
run;


***input sample pill dosing date;
***subject=patient number,dosedate=drug dosing date;
data dosing;
input subject $ dosedate date9.;
cards;
101 07sep2003
102 07oct2003
103 13nov2003
;
run;



*** sorting cholesterol data for merging with dosing data;
proc sort data=cholesterol_base;
by subject sampdate;
run;

***sorting dosing data for merging with cholesterol data.;
proc sort data=dosing;
by subject;
run;

***DEFINE BASELINE HDL,LDL,TRIG VARIABLES.;
data baseline(rename=(hdl=b_hdl ldl=b_ldl trig=b_trig));
merge cholesterol_base dosing;
by subject;
keep subject sampdate dosedate hdl ldl trig;
run;

proc print data=baseline;
run;
proc sort data=baseline;
by subject sampdate;
run;

Message was edited by: Sandeep Message was edited by: Sandeep
N/A
Posts: 0

Re: LOCF coding check continued..

*** Apply LOCF if the the value is within 5 days of dosing ***;
data locf;
set baseline;
by subject sampdate;
diff=dosedate-sampdate;
array base{3} b_hdl b_ldl b_trig;
array chol{3} hdl ldl trig;
retain hdl ldl trig;
do i=1 to 3;
if not(first.subject) and base{i}=. and 0 le diff le 5 then do;
chol{i} + base{i};
end;
else do;
chol{i} = base{i};
end;
end;
run; Message was edited by: Sandeep
N/A
Posts: 0

Re: LOCF coding check continued..

I hope this will solve the problem. Message was edited by: Sandeep
N/A
Posts: 0

zdifferent output ..plz reply..

Hi Sandeep..

thanx a lot for help.. n it actually produced an out put.
but it does not show the base line variables . it gives all the dates n values.

i want my report to look like this.

subject b_hdl b_ldl b_trig
101 49 185 108
102 52 . 360
103 32 240 880
so the final dataset produced will have a base line reading.. can u plz help again?
N/A
Posts: 0

Re: zdifferent output ..plz reply..

Hi there,

I believe that you are expecting a final dataset containg variables subject and the baseline values for three parameters on which LOCF is used and not the original baseline variables.
Do this:-
1) create a dataset by dropping b_hdl, b_ldl and b_trig
2) create one more datset by setting the dataset from step 1) and rename hdl, ldl and trig as b_hdl, b_ldl and b_tig respectively.

OR

Are you expecting, one record per subjects. If so, please check your baseline defination. Perform the above mentioned step and select the record as per the baseline defination.

Let me know if you still have questions further. :-) Message was edited by: Sandeep
Frequent Contributor
Posts: 95

Re: zdifferent output ..plz reply..

Try this:

***DEFINE BASELINE HDL,LDL,TRIG VARIABLES.;
data jessica.baseline;
merge jessica.cholesterol_base jessica.dosing;
by subject;
if dosedate - sampdate <= 5 and dosedate - sampdate > 0 then output;
run;

* This has to be a separate DATA step in order for the BY variable to work properly.;
data jessica.baseline;
set jessica.baseline;
by subject;
retain b_hdl b_ldl b_trig;
if first.subject then do;
b_hdl=.;
b_ldl=.;
b_trig=.;
end;
if hdl ne . then b_hdl = hdl;
if ldl ne . then b_ldl = ldl;
if trig ne . then b_trig = trig;
keep subject b_:;
if last.subject then output;
run;

proc print data=jessica.baseline;
run;
Ask a Question
Discussion stats
  • 6 replies
  • 541 views
  • 0 likes
  • 2 in conversation