<?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 Re: plz check the code.. in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4746#M398</link>
    <description>continued....&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;</description>
    <pubDate>Tue, 18 Sep 2007 14:28:08 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-09-18T14:28:08Z</dc:date>
    <item>
      <title>New variable during merge?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4743#M395</link>
      <description>HI everyone..&lt;BR /&gt;
&lt;BR /&gt;
I have a dataset baseline with variables which I merge with other dosing dataset&lt;BR /&gt;
by subject.&lt;BR /&gt;
how can i define new baseline variables in new dataset?&lt;BR /&gt;
&lt;BR /&gt;
basline dataset has variables subject , hdl,ldl,sampdate,trig.&lt;BR /&gt;
dosing dataset has variables subject,dosedate.&lt;BR /&gt;
&lt;BR /&gt;
first i did the sorting .&lt;BR /&gt;
then mergeing.&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
merge baseline dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
&lt;BR /&gt;
i want this new dataset to have variables like..&lt;BR /&gt;
b_hdl,b_ldl,b_trig.&lt;BR /&gt;
how do i do that.&lt;BR /&gt;
the system says the variables are not referenced.if i use keep.&lt;BR /&gt;
please help.&lt;BR /&gt;
&lt;BR /&gt;
thanx in advance&lt;BR /&gt;
april.</description>
      <pubDate>Tue, 18 Sep 2007 00:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4743#M395</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-18T00:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: New variable during merge?</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4744#M396</link>
      <description>If you are using RENAME and KEEP in one data set, then KEEP should contain the original variable names rather than renamed variable names.&lt;BR /&gt;
&lt;BR /&gt;
Try this out:-&lt;BR /&gt;
&lt;BR /&gt;
data new (rename=(hdl=b_hdl ldl=b_ldl trig=b_trig));&lt;BR /&gt;
merge baseline dosing;&lt;BR /&gt;
by subject;&lt;BR /&gt;
keep subject sampledate dosedat hdl ldl trig;&lt;BR /&gt;
run;

Message was edited by: Display name not found</description>
      <pubDate>Tue, 18 Sep 2007 05:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4744#M396</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-18T05:20:24Z</dc:date>
    </item>
    <item>
      <title>plz check the code..</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4745#M397</link>
      <description>thanx for the solution...&lt;BR /&gt;
&lt;BR /&gt;
but the problem still stays..&lt;BR /&gt;
&lt;BR /&gt;
i am writing the coding plz see where i am making a mistake.&lt;BR /&gt;
&lt;BR /&gt;
the output i want from this dataset is that it should show locf so long as the measures occur withina five day window befor the pill is taken.&lt;BR /&gt;
&lt;BR /&gt;
code:&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;
&lt;BR /&gt;
data 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;
&lt;BR /&gt;
data 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=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=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 baseline(rename=(hdl=b_hdl ldl=b_ldl trig=b_trig));&lt;BR /&gt;
merge cholesterol_base 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=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;</description>
      <pubDate>Tue, 18 Sep 2007 14:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4745#M397</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-18T14:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: plz check the code..</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4746#M398</link>
      <description>continued....&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;</description>
      <pubDate>Tue, 18 Sep 2007 14:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/New-variable-during-merge/m-p/4746#M398</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-09-18T14:28:08Z</dc:date>
    </item>
  </channel>
</rss>

