<?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: Understanding SAS dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105350#M29403</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a better way to show / copy code to my post ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Aug 2013 16:58:03 GMT</pubDate>
    <dc:creator>podarum</dc:creator>
    <dc:date>2013-08-08T16:58:03Z</dc:date>
    <item>
      <title>Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105347#M29400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp; could anyone tell me why when I run this below code, I also get data outside of the requested period..&amp;nbsp; for example I get data before 2013, eg. Jun 2012, etc.&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 16:46:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105347#M29400</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2013-08-08T16:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105348#M29401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where is the code??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 16:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105348#M29401</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2013-08-08T16:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105349#M29402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry about that.. had problems wiht my browser.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(select distinct val_typ, ast_id, val_dt13, val_amt13, rlst_val_dt from (select&amp;nbsp; distinct 'appraised_amt' as val_typ, ast_id, rlst_val_dt, case when&amp;nbsp; rlst_val_eff_dt is null then rlst_val_dt when rlst_val_dt is not null and rlst_val_dt &amp;lt; rlst_val_eff_dt then rlst_val_dt else rlst_val_eff_dt end as val_dt13, apprs_val_amt as val_amt13 from DDWV01.rlst_val_dly where ((rlst_val_dt between '2013-01-01' and '2013-07-30' ) or (rlst_val_eff_dt between '2013-01-01' and '2013-07-30' ) ) and&amp;nbsp; apprs_val_amt is not null union&amp;nbsp;&amp;nbsp; select&amp;nbsp; distinct 'sale_amt' as val_typ, ast_id, sale_dt, sale_VAL_amt, rlst_val_dt&amp;nbsp;&amp;nbsp; from DDWV01.rlst_val_dly where (sale_dt between '2013-01-01' and '2013-07-30' ) and sale_VAL_amt is not null ) x&amp;nbsp;&amp;nbsp; ); quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 16:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105349#M29402</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2013-08-08T16:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105350#M29403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a better way to show / copy code to my post ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 16:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105350#M29403</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2013-08-08T16:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105351#M29404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since your data literals are text and not actual SAS date literals, such as "01JAN2013"D, you are getting string comparisons and not date comparisons. I would check for consistency of data coding. Second would be to show some of the erroneous results involving all of the variables involved in the selection logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only way I get this forum to display code the way I write it is to use a pure text editor like Notepad. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 17:10:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105351#M29404</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-08-08T17:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105352#M29405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks... I have to investigate further...&amp;nbsp; Is there a way I can link 2 datasets 1 table has Date_A and the second table has Date_B and my link is to link accts. where Date_A &amp;lt; Date_B up to a year later (so Date_A &amp;lt; Date_B + 365)... does that work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 17:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105352#M29405</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2013-08-08T17:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105353#M29406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a strong likelihood of getting multiple matches for each value of Date_A with that rule, is that acceptable for your purpose?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2013 20:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105353#M29406</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-08-08T20:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding SAS dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105354#M29407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As ballardw points out, if you have multiple rows for acct (e.g. multiple dates per acct) then you may get mutiple rows for a given acct in your output depending on how your structure your query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following sample assumes only one row per acct in each dataset, and that all accts exist in both datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* creates a dataset with one record for each 'acct' with a random date (dateA) */&lt;BR /&gt;DATA a;&lt;BR /&gt; drop i datedif;&lt;BR /&gt; format dateA date9.;&lt;BR /&gt; datedif = today() - '01Jan1960'd + 1;&lt;BR /&gt; do i = 1 to 100 ;&lt;BR /&gt;&amp;nbsp; acct + 1 ;&lt;BR /&gt;&amp;nbsp; dateA = round((datedif*ranuni(0)))+1 ;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* creates a second dataset, one record for each 'acct' with another random date (dateB) */&lt;BR /&gt;DATA b;&lt;BR /&gt; drop i datedif;&lt;BR /&gt; format dateB date9.;&lt;BR /&gt; datedif = today() - '01Jan1960'd + 1;&lt;BR /&gt; do i = 1 to 100 ;&lt;BR /&gt;&amp;nbsp; acct + 1 ;&lt;BR /&gt;&amp;nbsp; dateB = round((datedif*ranuni(0)))+1 ;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create table of matches where dateA is less than dateB+365) */&lt;BR /&gt;proc sql;&lt;BR /&gt; create table want as&lt;BR /&gt; select a.acct, a.dateA, b.dateB, intnx('year', dateb, 1, 'same') as cutoffdt format=date9.&lt;BR /&gt; from a, b&lt;BR /&gt; where a.acct=b.acct&lt;BR /&gt;&amp;nbsp; and a.datea&amp;lt;intnx('year', dateb, 1, 'same')&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Aug 2013 00:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Understanding-SAS-dates/m-p/105354#M29407</guid>
      <dc:creator>Fugue</dc:creator>
      <dc:date>2013-08-09T00:52:35Z</dc:date>
    </item>
  </channel>
</rss>

