<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic LOCF coding check. in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/LOCF-coding-check/m-p/4747#M399</link>
    <description>Hi!!&lt;BR /&gt;
&lt;BR /&gt;
i am strugling with this.. please check the coding and let me know where i am making a mistake.&lt;BR /&gt;
i want last obs carried forward in output so long as the measure occurs within a 5 day window before the desired pill is taken.&lt;BR /&gt;
&lt;BR /&gt;
*** Input Sample cholesterol data;&lt;BR /&gt;
***subject=patient number,sampdate=lab sample date,&lt;BR /&gt;
***HDL=HDL,LDL=LDL,TRIG=Triglycerides.;&lt;BR /&gt;
data jessica.cholesterol_base;&lt;BR /&gt;
input subject $ sampdate date9. hdl ldl trig;&lt;BR /&gt;
cards;&lt;BR /&gt;
101 05sep2003 48 188 108&lt;BR /&gt;
101 06sep2003 49 185 .&lt;BR /&gt;
102 01oct2003 54 200 350&lt;BR /&gt;
102 02oct2003 52 .   360&lt;BR /&gt;
103 10nov2003 . 240  900&lt;BR /&gt;
103 11nov2003 30 .   880&lt;BR /&gt;
103 12nov2003 32 .   .&lt;BR /&gt;
103 13nov2003 35 289 930&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
***input sample pill dosing date;&lt;BR /&gt;
***subject=patient number,dosedate=drug dosing date;&lt;BR /&gt;
data jessica.dosing;&lt;BR /&gt;
input subject $ dosedate date9.;&lt;BR /&gt;
cards;&lt;BR /&gt;
101 07sep2003&lt;BR /&gt;
102 07oct2003&lt;BR /&gt;
103 13nov2003&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** sorting cholesterol data for merging with dosing data;&lt;BR /&gt;
proc sort data=jessica.cholesterol_base;&lt;BR /&gt;
by subject sampdate;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
***sorting dosing data for merging with cholesterol data.;&lt;BR /&gt;
proc sort data=jessica.dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
***DEFINE BASELINE HDL,LDL,TRIG VARIABLES.;&lt;BR /&gt;
data jessica.baseline(rename=(hdl=b_hdl ldl=b_ldl trig=b_trig));&lt;BR /&gt;
merge jessica.cholesterol_base jessica.dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
keep subject hdl ldl trig;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=jessica.baseline;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
*** setup array for baseline variables and lab values.;&lt;BR /&gt;
array base{3} b_hdl b_ldl b_trig;&lt;BR /&gt;
array chol{3} hdl ldl trig;&lt;BR /&gt;
&lt;BR /&gt;
*** retain new baseline variables so they are present at last.subject below.;&lt;BR /&gt;
 retain b_hdl b_ldl b_trig;&lt;BR /&gt;
&lt;BR /&gt;
 *** initialize baseline variable to missing.;&lt;BR /&gt;
 if first.subject then&lt;BR /&gt;
 do i= 1 to 3;&lt;BR /&gt;
 base{i} = .;&lt;BR /&gt;
 end;&lt;BR /&gt;
&lt;BR /&gt;
 *** if labvalue is within 5 days of dosing,retain it as a valid baseline.;&lt;BR /&gt;
 if 1 &amp;lt;=(dosedate-sampdate)&amp;lt;=5 then&lt;BR /&gt;
 do i = 1 to 3 ;&lt;BR /&gt;
 if chol{i} ne . then&lt;BR /&gt;
 base{i} = chol{i};&lt;BR /&gt;
 end;&lt;BR /&gt;
 *** keep last record per patient holding the locf values.;&lt;BR /&gt;
 if last.subject;&lt;BR /&gt;
 label b_hdl="baseline hdl"&lt;BR /&gt;
       b_ldl="baseline ldl"&lt;BR /&gt;
	   b_trig="baseline triglycerides";&lt;BR /&gt;
       run;&lt;BR /&gt;
&lt;BR /&gt;
Thanx in advance.&lt;BR /&gt;
april.</description>
    <pubDate>Tue, 18 Sep 2007 14:32:51 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-09-18T14:32:51Z</dc:date>
    <item>
      <title>LOCF coding check.</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/LOCF-coding-check/m-p/4747#M399</link>
      <description>Hi!!&lt;BR /&gt;
&lt;BR /&gt;
i am strugling with this.. please check the coding and let me know where i am making a mistake.&lt;BR /&gt;
i want last obs carried forward in output so long as the measure occurs within a 5 day window before the desired pill is taken.&lt;BR /&gt;
&lt;BR /&gt;
*** Input Sample cholesterol data;&lt;BR /&gt;
***subject=patient number,sampdate=lab sample date,&lt;BR /&gt;
***HDL=HDL,LDL=LDL,TRIG=Triglycerides.;&lt;BR /&gt;
data jessica.cholesterol_base;&lt;BR /&gt;
input subject $ sampdate date9. hdl ldl trig;&lt;BR /&gt;
cards;&lt;BR /&gt;
101 05sep2003 48 188 108&lt;BR /&gt;
101 06sep2003 49 185 .&lt;BR /&gt;
102 01oct2003 54 200 350&lt;BR /&gt;
102 02oct2003 52 .   360&lt;BR /&gt;
103 10nov2003 . 240  900&lt;BR /&gt;
103 11nov2003 30 .   880&lt;BR /&gt;
103 12nov2003 32 .   .&lt;BR /&gt;
103 13nov2003 35 289 930&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
***input sample pill dosing date;&lt;BR /&gt;
***subject=patient number,dosedate=drug dosing date;&lt;BR /&gt;
data jessica.dosing;&lt;BR /&gt;
input subject $ dosedate date9.;&lt;BR /&gt;
cards;&lt;BR /&gt;
101 07sep2003&lt;BR /&gt;
102 07oct2003&lt;BR /&gt;
103 13nov2003&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
*** sorting cholesterol data for merging with dosing data;&lt;BR /&gt;
proc sort data=jessica.cholesterol_base;&lt;BR /&gt;
by subject sampdate;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
***sorting dosing data for merging with cholesterol data.;&lt;BR /&gt;
proc sort data=jessica.dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
***DEFINE BASELINE HDL,LDL,TRIG VARIABLES.;&lt;BR /&gt;
data jessica.baseline(rename=(hdl=b_hdl ldl=b_ldl trig=b_trig));&lt;BR /&gt;
merge jessica.cholesterol_base jessica.dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
keep subject hdl ldl trig;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=jessica.baseline;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
*** setup array for baseline variables and lab values.;&lt;BR /&gt;
array base{3} b_hdl b_ldl b_trig;&lt;BR /&gt;
array chol{3} hdl ldl trig;&lt;BR /&gt;
&lt;BR /&gt;
*** retain new baseline variables so they are present at last.subject below.;&lt;BR /&gt;
 retain b_hdl b_ldl b_trig;&lt;BR /&gt;
&lt;BR /&gt;
 *** initialize baseline variable to missing.;&lt;BR /&gt;
 if first.subject then&lt;BR /&gt;
 do i= 1 to 3;&lt;BR /&gt;
 base{i} = .;&lt;BR /&gt;
 end;&lt;BR /&gt;
&lt;BR /&gt;
 *** if labvalue is within 5 days of dosing,retain it as a valid baseline.;&lt;BR /&gt;
 if 1 &amp;lt;=(dosedate-sampdate)&amp;lt;=5 then&lt;BR /&gt;
 do i = 1 to 3 ;&lt;BR /&gt;
 if chol{i} ne . then&lt;BR /&gt;
 base{i} = chol{i};&lt;BR /&gt;
 end;&lt;BR /&gt;
 *** keep last record per patient holding the locf values.;&lt;BR /&gt;
 if last.subject;&lt;BR /&gt;
 label b_hdl="baseline hdl"&lt;BR /&gt;
       b_ldl="baseline ldl"&lt;BR /&gt;
	   b_trig="baseline triglycerides";&lt;BR /&gt;
       run;&lt;BR /&gt;
&lt;BR /&gt;
Thanx in advance.&lt;BR /&gt;
april.</description>
      <pubDate>Tue, 18 Sep 2007 14:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/LOCF-coding-check/m-p/4747#M399</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-18T14:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: LOCF coding check.</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/LOCF-coding-check/m-p/4748#M400</link>
      <description>I would suggest not renaming the hdl, ldl and trig variables, but assigning the value when the date criteria is met.  When the dosedate - sampdate is less than or equal to 5, then assign the hdl, ldl and trig values to b_hdl, b_ldl, and b_trig.  Here's and example:&lt;BR /&gt;
&lt;BR /&gt;
data jessica.baseline;&lt;BR /&gt;
merge jessica.cholesterol_base jessica.dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
keep subject b_:;&lt;BR /&gt;
if dosedate - sampdate &amp;lt;=5 then do;&lt;BR /&gt;
	b_hdl=hdl;&lt;BR /&gt;
	b_ldl=ldl;&lt;BR /&gt;
	b_trig=trig;&lt;BR /&gt;
end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=jessica.baseline;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Is this what you're looking for?</description>
      <pubDate>Tue, 25 Sep 2007 16:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/LOCF-coding-check/m-p/4748#M400</guid>
      <dc:creator>1162</dc:creator>
      <dc:date>2007-09-25T16:35:33Z</dc:date>
    </item>
  </channel>
</rss>

