<?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 Determine if a license is valid within a range. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605767#M175821</link>
    <description>&lt;P&gt;Good Morning,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find out if a license was valid between a date range. I have and id number of the license, begin date and the expiration date of the licenses. The date range is 11/19/2017-11/19/2019.&amp;nbsp; I can do one year without much of an issue by looking for licenses that expired within that range or that the begin date fell within it.&amp;nbsp;The catch is that some of the licenses are valid for 5 years and when using that logic may not be captured in the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 15:07:53 GMT</pubDate>
    <dc:creator>Franknferter</dc:creator>
    <dc:date>2019-11-20T15:07:53Z</dc:date>
    <item>
      <title>Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605767#M175821</link>
      <description>&lt;P&gt;Good Morning,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find out if a license was valid between a date range. I have and id number of the license, begin date and the expiration date of the licenses. The date range is 11/19/2017-11/19/2019.&amp;nbsp; I can do one year without much of an issue by looking for licenses that expired within that range or that the begin date fell within it.&amp;nbsp;The catch is that some of the licenses are valid for 5 years and when using that logic may not be captured in the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605767#M175821</guid>
      <dc:creator>Franknferter</dc:creator>
      <dc:date>2019-11-20T15:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605769#M175822</link>
      <description>&lt;P&gt;Please supply representative example data in usable form, e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $ (begdate enddate) (:yymmdd10.);
format begdate enddate yymmddd10.;
datalines;
123456 2017-11-19 2019-11-19
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605769#M175822</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T15:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605775#M175824</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have start and end dates why does the 5 years matter?&lt;/P&gt;
&lt;P&gt;How do you know if a license is 1 year or 5 year?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your data ll in the same data set or different data sets? Does the range change or is it fixed? Are your variables SAS dates?&lt;BR /&gt;Can all rows be handled in the same manner or do you need to do this over years/groups?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most would likely be answered with sample data.&lt;/P&gt;
&lt;P&gt;Here are instructions on how to provide sample data as a data step:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 15:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605775#M175824</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-11-20T15:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605831#M175841</link>
      <description>&lt;P&gt;Sorry, I'm still a bit new to SAS. you almost got the fields named correctly too. The 5 years matter because someone can start before the first date that I want to know if its valid and expire after, I just don't know how to capture them, but while getting this small data set together i realized that I could just separate the 5 year licenses just pull those that were purchased between 11/19/2012-11/19/2019 and that would accomplish the same thing. I could also be explaining this poorly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but here is a sample of the data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input id $ (startDate expireDate) (:yymmdd10.);&lt;BR /&gt;format startDate expireDate yymmddd10.;&lt;BR /&gt;datalines;&lt;BR /&gt;123456 2017-11-19 2018-11-19&lt;BR /&gt;123565 2015-07-23 2020-07-23&lt;BR /&gt;995874 2017-11-16 2018-11-16&lt;BR /&gt;986632 2005-01-08 2099-01-08&lt;BR /&gt;;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605831#M175841</guid>
      <dc:creator>Franknferter</dc:creator>
      <dc:date>2019-11-20T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605849#M175851</link>
      <description>&lt;P&gt;And what do you expect to get out of this example dataset?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605849#M175851</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T17:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605851#M175852</link>
      <description>&lt;P&gt;Wait, I think I see where you want to go. See this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id $ (startDate expireDate) (:yymmdd10.);
format startDate expireDate yymmddd10.;
datalines;
123456 2017-11-19 2018-11-19
123565 2015-07-23 2020-07-23
995874 2017-11-16 2018-11-16
986632 2005-01-08 2099-01-08
888888 2010-01-01 2016-12-31
999999 2019-11-20 2029-11-20
;

%let period_start=%sysfunc(inputn(2017-11-19,yymmdd10.));
%let period_end=%sysfunc(inputn(2019-11-19,yymmdd10.));

data want;
set have;
flag = (startdate &amp;lt;= &amp;amp;period_end and expiredate &amp;gt;= &amp;amp;period_start);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I added two cases that fall completely out of the period, to force a "false" flag.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:46:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605851#M175852</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-20T17:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a license is valid within a range.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605882#M175867</link>
      <description>&lt;P&gt;That worked! I am still reading and learning the SAS base programming book, but after reading about some of the commands you had it all makes sense. Its just knowing what options I have to make things easier. Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 18:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-license-is-valid-within-a-range/m-p/605882#M175867</guid>
      <dc:creator>Franknferter</dc:creator>
      <dc:date>2019-11-20T18:48:44Z</dc:date>
    </item>
  </channel>
</rss>

