<?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 How dervie the flag for last available record in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/695807#M212374</link>
    <description>&lt;P&gt;I have a Vital dataset that I created with help of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;. I have the requirement to Flag the last available flag for every Param in my dataset. These are my conditions.&lt;/P&gt;
&lt;P&gt;Flag&amp;nbsp; last available record&amp;nbsp; where firstdtc&amp;gt;seconddtc ( this will be true for Records where&amp;nbsp; they have status "Post". In that case, I need to flag the records that have the status "Pre")&lt;/P&gt;
&lt;P&gt;If any param is missing in the last Visit (Visit 3) then it should flag before Visit where that Param available.&lt;/P&gt;
&lt;P&gt;Weight is the exception because it did not have pre or post status. So it should flag in the last available visit for respective subjects. I am attaching the excel pic example, to get an Idea of how the flag"Y"&amp;nbsp; shows up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_1-1604272147323.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51300iD71F825FFC32FE95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_1-1604272147323.png" alt="SASuserlot_1-1604272147323.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vital;
infile datalines truncover; 
input
  @1 usubjid :$11.
  @13 param :$10.
  @23 status :$4.
  @29 visit :$7.
  @37 _firstdt anydtdte11.
  @49 _firsttm time8.
  @59 _seconddt anydtdte11.
  @71 _secondtm time8.
  @81 type :$10.
;
format firstdtc seconddtc e8601dt19.;
firstdtc = dhms(_firstdt,0,0,_firsttm);
seconddtc = dhms(_seconddt,0,0,_secondtm);
drop _:;
datalines;
SD-1001-101 diastolic pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 diastolic post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 systolic  pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 systolic  post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 temp      pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 temp      post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 height    pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 height    post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 weight          Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 weight          Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 diastolic pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 diastolic post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 systolic  pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 systolic  post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 temp      pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 temp      post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 height    pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 height    post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 diastolic pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 diastolic post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 systolic  pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 systolic  post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 temp      pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 temp      post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 height    pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 height    post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 weight          Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 weight          Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 diastolic pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 diastolic post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 systolic  pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 systolic  post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 height    pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 height    post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 weight          Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 weight          Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 systolic  pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 systolic  post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 temp      pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 temp      post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 systolic  pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 systolic  post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 temp      pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 temp      post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 height    pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 height    post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 weight          Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 weight          Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
;
run;
Data Vital1;
set vital;
if status="Visi" then status="";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 01 Nov 2020 23:09:38 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2020-11-01T23:09:38Z</dc:date>
    <item>
      <title>How dervie the flag for last available record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/695807#M212374</link>
      <description>&lt;P&gt;I have a Vital dataset that I created with help of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;. I have the requirement to Flag the last available flag for every Param in my dataset. These are my conditions.&lt;/P&gt;
&lt;P&gt;Flag&amp;nbsp; last available record&amp;nbsp; where firstdtc&amp;gt;seconddtc ( this will be true for Records where&amp;nbsp; they have status "Post". In that case, I need to flag the records that have the status "Pre")&lt;/P&gt;
&lt;P&gt;If any param is missing in the last Visit (Visit 3) then it should flag before Visit where that Param available.&lt;/P&gt;
&lt;P&gt;Weight is the exception because it did not have pre or post status. So it should flag in the last available visit for respective subjects. I am attaching the excel pic example, to get an Idea of how the flag"Y"&amp;nbsp; shows up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_1-1604272147323.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51300iD71F825FFC32FE95/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_1-1604272147323.png" alt="SASuserlot_1-1604272147323.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data vital;
infile datalines truncover; 
input
  @1 usubjid :$11.
  @13 param :$10.
  @23 status :$4.
  @29 visit :$7.
  @37 _firstdt anydtdte11.
  @49 _firsttm time8.
  @59 _seconddt anydtdte11.
  @71 _secondtm time8.
  @81 type :$10.
;
format firstdtc seconddtc e8601dt19.;
firstdtc = dhms(_firstdt,0,0,_firsttm);
seconddtc = dhms(_seconddt,0,0,_secondtm);
drop _:;
datalines;
SD-1001-101 diastolic pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 diastolic post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 systolic  pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 systolic  post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 temp      pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 temp      post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 height    pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 height    post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 weight          Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 weight          Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 diastolic pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 diastolic post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 systolic  pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 systolic  post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 temp      pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 temp      post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 height    pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-102 height    post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 diastolic pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 diastolic post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 systolic  pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 systolic  post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 temp      pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 temp      post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 height    pre   Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 height    post  Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 weight          Visit1  2018-MAR-19T10:10:10  2018-MAR-19T10:30:10  first
SD-1001-103 weight          Visit1  2018-MAR-19T11:10:10  2018-MAR-19T10:30:10  first
SD-1001-101 diastolic pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 diastolic post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 systolic  pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 systolic  post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 height    pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 height    post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 weight          Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-101 weight          Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 systolic  pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 systolic  post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 temp      pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-102 temp      post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 systolic  pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 systolic  post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 temp      pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 temp      post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 height    pre   Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 height    post  Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 weight          Visit2  2018-MAR-25T10:10:10  2018-MAR-25T10:30:10  second
SD-1001-103 weight          Visit2  2018-MAR-25T11:10:10  2018-MAR-25T10:30:10  second
;
run;
Data Vital1;
set vital;
if status="Visi" then status="";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Nov 2020 23:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/695807#M212374</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2020-11-01T23:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: How dervie the flag for last available record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/696793#M212897</link>
      <description>&lt;P&gt;Your needs are unclear.&lt;/P&gt;
&lt;P&gt;Please provide less test data and more explanations.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 07:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/696793#M212897</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-05T07:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: How dervie the flag for last available record</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/696858#M212931</link>
      <description>I provided the sas code! Which generate the test dataset. May be u missed it</description>
      <pubDate>Thu, 05 Nov 2020 13:05:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-dervie-the-flag-for-last-available-record/m-p/696858#M212931</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2020-11-05T13:05:46Z</dc:date>
    </item>
  </channel>
</rss>

