<?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 Flagging baseline flag based on multiple conditions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/857975#M338991</link>
    <description>&lt;P&gt;Hi there, I am just trying some thing with some data that i have and it seems that i am missing out on following few of the conditions while trying to flag the baseline records based on my following conditions.&lt;/P&gt;&lt;P&gt;1. if there are several records for a single test in a visit with the same result&amp;nbsp; i need to flag the closest one to the target date.&lt;/P&gt;&lt;P&gt;2.if there are several records for a test on same visit with different results i need to flag the worst result as the baseline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE:R is the worst result for consideration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id test&amp;nbsp; visit&amp;nbsp; dy targetdy result&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp;-29&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Am trying this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;set xx;&lt;BR /&gt;by id test visit result;&lt;BR /&gt;if result eq "S" then worstord=1;&lt;BR /&gt;else if result eq "R" then worstord=2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sort data=xx; by id test visit worstord;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data blfl;&lt;BR /&gt;set xx;&lt;BR /&gt;by id&amp;nbsp;test visit worstord;&lt;BR /&gt;if visit=1 and last.visit and worstord=2 then ABLFL="Y";&lt;BR /&gt;else if visit=1 and last.visit and worstord=1 then ABLFL="Y";&lt;BR /&gt;IF visit EQ 1 Then do;&lt;BR /&gt;if first.visit then numrec=1;&lt;BR /&gt;else numrec+1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;your help is much appreciated!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks alot&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2023 10:15:02 GMT</pubDate>
    <dc:creator>sandhya88</dc:creator>
    <dc:date>2023-02-09T10:15:02Z</dc:date>
    <item>
      <title>Flagging baseline flag based on multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/857975#M338991</link>
      <description>&lt;P&gt;Hi there, I am just trying some thing with some data that i have and it seems that i am missing out on following few of the conditions while trying to flag the baseline records based on my following conditions.&lt;/P&gt;&lt;P&gt;1. if there are several records for a single test in a visit with the same result&amp;nbsp; i need to flag the closest one to the target date.&lt;/P&gt;&lt;P&gt;2.if there are several records for a test on same visit with different results i need to flag the worst result as the baseline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE:R is the worst result for consideration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id test&amp;nbsp; visit&amp;nbsp; dy targetdy result&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp;-29&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Am trying this code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data xx;&lt;BR /&gt;set xx;&lt;BR /&gt;by id test visit result;&lt;BR /&gt;if result eq "S" then worstord=1;&lt;BR /&gt;else if result eq "R" then worstord=2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc sort data=xx; by id test visit worstord;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data blfl;&lt;BR /&gt;set xx;&lt;BR /&gt;by id&amp;nbsp;test visit worstord;&lt;BR /&gt;if visit=1 and last.visit and worstord=2 then ABLFL="Y";&lt;BR /&gt;else if visit=1 and last.visit and worstord=1 then ABLFL="Y";&lt;BR /&gt;IF visit EQ 1 Then do;&lt;BR /&gt;if first.visit then numrec=1;&lt;BR /&gt;else numrec+1;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;your help is much appreciated!!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks alot&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 10:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/857975#M338991</guid>
      <dc:creator>sandhya88</dc:creator>
      <dc:date>2023-02-09T10:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging baseline flag based on multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/858042#M339018</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/387419"&gt;@sandhya88&lt;/a&gt;, Thanks for providing some sample data that we can work with. Could you please show us what you want your dataset to look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you mention date in reference to target date - is it supposed to be a date value?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 15:07:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/858042#M339018</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2023-02-09T15:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: Flagging baseline flag based on multiple conditions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/858044#M339019</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for looking at my data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is what i wanted it to look alike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id test&amp;nbsp; visit&amp;nbsp; dy targetdy result&amp;nbsp; baselineflg&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp;-29&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; R&lt;/P&gt;&lt;P&gt;1&amp;nbsp; tst1&amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry for the text above please consider the closest dy to targetdy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 15:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flagging-baseline-flag-based-on-multiple-conditions/m-p/858044#M339019</guid>
      <dc:creator>sandhya88</dc:creator>
      <dc:date>2023-02-09T15:12:43Z</dc:date>
    </item>
  </channel>
</rss>

