<?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: Calculating from SQL to SAS Proc in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115406#M31899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;intnx('week',LastOrder,0,'end') - intnx('week',c.FirstOrderDate,0,'Begin')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Apr 2013 11:56:16 GMT</pubDate>
    <dc:creator>DBailey</dc:creator>
    <dc:date>2013-04-22T11:56:16Z</dc:date>
    <item>
      <title>Calculating from SQL to SAS Proc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115404#M31897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping someone could give me a hand working through this... I'm still working out what my tool set is in SAS...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Here is a piece of SQL code that I use to return the weeks active for a customer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically it works out what Week Starting date was the week a custs first order was made, and the last day of the week for their most recent order.&lt;/P&gt;&lt;P&gt;It then works out the difference between the two and gives me an int value. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datediff(wk,dateadd(week, datediff(week, 0, c.FirstOrderDate),0), dateadd(week, datediff(week, 0, LastOrder), 6)) &lt;/P&gt;&lt;P&gt; AS 'Weeks Active'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DateAdd doesn't appear to be in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been looking at &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003065889.htm#a003065892" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003065889.htm#a003065892"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt; to try and work out how to make this work... But I'm getting confused.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone done this before_r&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Apr 2013 06:13:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115404#M31897</guid>
      <dc:creator>breelloyd</dc:creator>
      <dc:date>2013-04-22T06:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating from SQL to SAS Proc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115405#M31898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DateDiff isn't SAS function as well.&lt;/P&gt;&lt;P&gt;You can use INTNX() function to do this calculation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Apr 2013 07:10:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115405#M31898</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-04-22T07:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating from SQL to SAS Proc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115406#M31899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;intnx('week',LastOrder,0,'end') - intnx('week',c.FirstOrderDate,0,'Begin')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Apr 2013 11:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115406#M31899</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2013-04-22T11:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating from SQL to SAS Proc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115407#M31900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;intnx('week',LastOrder,0,'end') - intnx('week',c.FirstOrderDate,0,'Begin') will probably work, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I'm getting . for all fields. So I need to work out why that's happening. Both fields are formatted the same way. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I'll keep chipping away until I work it out.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 05:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115407#M31900</guid>
      <dc:creator>breelloyd</dc:creator>
      <dc:date>2013-04-23T05:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating from SQL to SAS Proc</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115408#M31901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it to work. Thank you very much!! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Apr 2013 05:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculating-from-SQL-to-SAS-Proc/m-p/115408#M31901</guid>
      <dc:creator>breelloyd</dc:creator>
      <dc:date>2013-04-23T05:39:19Z</dc:date>
    </item>
  </channel>
</rss>

