<?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 Flag Based on Dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594803#M170981</link>
    <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been an SPSS user for a very long time and I now have to learn how to use SAS. I am having trouble creating a flag variable of enrolled based on dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; entry_date&amp;nbsp; leave_date&amp;nbsp; &amp;nbsp;leave_code&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 2015-09-01&amp;nbsp; 2016-07-01&amp;nbsp; L&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 2013-08-27&amp;nbsp; 9999-12-31&amp;nbsp; &amp;nbsp;N&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 2014-11-19&amp;nbsp; 2015-02-28&amp;nbsp; L&lt;/P&gt;&lt;P&gt;4&amp;nbsp; 2013-12-31&amp;nbsp; 2016-09-15&amp;nbsp; T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do a 1 or 0, 1 indicating still enrolled. Basically if the leave date is eq 9999-12-31 student is still enrolled if the leave_date is gt 2016-06-30 then the student is still enrolled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this would be greatly appreciated!&lt;/P&gt;</description>
    <pubDate>Tue, 08 Oct 2019 16:29:44 GMT</pubDate>
    <dc:creator>JoserT</dc:creator>
    <dc:date>2019-10-08T16:29:44Z</dc:date>
    <item>
      <title>Flag Based on Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594803#M170981</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been an SPSS user for a very long time and I now have to learn how to use SAS. I am having trouble creating a flag variable of enrolled based on dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following data set:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; entry_date&amp;nbsp; leave_date&amp;nbsp; &amp;nbsp;leave_code&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 2015-09-01&amp;nbsp; 2016-07-01&amp;nbsp; L&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 2013-08-27&amp;nbsp; 9999-12-31&amp;nbsp; &amp;nbsp;N&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 2014-11-19&amp;nbsp; 2015-02-28&amp;nbsp; L&lt;/P&gt;&lt;P&gt;4&amp;nbsp; 2013-12-31&amp;nbsp; 2016-09-15&amp;nbsp; T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to do a 1 or 0, 1 indicating still enrolled. Basically if the leave date is eq 9999-12-31 student is still enrolled if the leave_date is gt 2016-06-30 then the student is still enrolled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on this would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 16:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594803#M170981</guid>
      <dc:creator>JoserT</dc:creator>
      <dc:date>2019-10-08T16:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Flag Based on Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594805#M170983</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id  (entry_date  leave_date ) (:yymmdd10.)  leave_code $;
format entry_date  leave_date yymmdd10.;
cards;
1  2015-09-01  2016-07-01  L
2  2013-08-27  9999-12-31   N
3  2014-11-19  2015-02-28  L
4  2013-12-31  2016-09-15  T
;

data want;
set have;
Flag=leave_date eq '31dec9999'd or leave_date gt '30jun2016'd;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2019 16:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594805#M170983</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-10-08T16:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Flag Based on Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594806#M170984</link>
      <description>&lt;P&gt;Hey, everything will depend on how formatted are your variables. Could you show us how they are?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 16:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594806#M170984</guid>
      <dc:creator>FelipeMosquetta</dc:creator>
      <dc:date>2019-10-08T16:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Flag Based on Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594811#M170988</link>
      <description>&lt;P&gt;What did you try?&amp;nbsp; The result of a boolean expression is going to be either 1 (true) or 0 (false);&lt;/P&gt;
&lt;P&gt;31DEC9999 is also greater than 30JUN2016 so you probably just need one test.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  flag = leave_date &amp;gt; '30JUN2016'd;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Oct 2019 16:51:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594811#M170988</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-08T16:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Flag Based on Dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594812#M170989</link>
      <description>&lt;P&gt;Good catch Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; Most embarrassing moment to not think that&amp;nbsp;&lt;SPAN&gt;31DEC9999 is also greater than 30JUN2016 . What a shame I caused to myself lol, Cheers though! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 16:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-Based-on-Dates/m-p/594812#M170989</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-10-08T16:54:14Z</dc:date>
    </item>
  </channel>
</rss>

