<?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: how to find current week in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375348#M89973</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86567"&gt;@SASAna&lt;/a&gt;&amp;nbsp;not seeing anything wrong with your code so it's a logic error. To clarify we'll need to see what the variable looks like, what the type is and are you absolutely sure you have data for this week already?&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 15:02:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-07-12T15:02:44Z</dc:date>
    <item>
      <title>how to find current week in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375336#M89966</link>
      <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted some help in finding the current week logic like below. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Logic - get the current week from the Modiefied date and compare it with the current week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; where&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;week(datepart(modified_date)) eq&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;week(today())&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data current_week;&lt;BR /&gt;set previous_dataset; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ----------&amp;gt; &amp;nbsp;it has a field &amp;nbsp;'modified_date' &amp;nbsp;- a date field.&lt;BR /&gt;where &lt;STRONG&gt;week(datepart(modified_date)) eq week(today());&lt;/STRONG&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ana&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 14:43:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375336#M89966</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2017-07-12T14:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to find current week in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375343#M89969</link>
      <description>&lt;P&gt;Exactly what help do you want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please explain what is not working. Show us a portion of your data. Show us the relevant code and relevant parts of the SASLOG.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 14:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375343#M89969</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-07-12T14:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to find current week in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375347#M89972</link>
      <description>&lt;P&gt;First a couple of general guidelines ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a date variable, you would not apply DATEPART to it.&amp;nbsp; DATEPART only applies to a variable that contains a datetime value, to extract the date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The WEEK function finds the week within the year.&amp;nbsp; So if&amp;nbsp;you compare the WEEK of TODAY() to the WEEK of some other date variable, you could find a match for dates that are a year apart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is in your existing modified date variable?&amp;nbsp; Data for every day, or just data for one day per week?&amp;nbsp; It is conceivable you could use something as simple as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where modified_date &amp;gt; today() - 7;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375347#M89972</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-12T15:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to find current week in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375348#M89973</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86567"&gt;@SASAna&lt;/a&gt;&amp;nbsp;not seeing anything wrong with your code so it's a logic error. To clarify we'll need to see what the variable looks like, what the type is and are you absolutely sure you have data for this week already?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375348#M89973</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-12T15:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to find current week in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375355#M89975</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Requirment is to get the current week's work assignments by using the modified_date field.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;modified_date is datetime field. So i have used datepart function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data current_week;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set previous_dataset; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;where&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;datepart(modified_date) le today() - 7 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ana&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375355#M89975</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2017-07-12T15:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to find current week in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375358#M89977</link>
      <description>&lt;P&gt;So that's most of the way there.&amp;nbsp;&amp;nbsp; The comparison "le" is incorrect, as it selects the wrong time period.&amp;nbsp; Replace it with either &amp;gt; or &amp;gt;=&amp;nbsp; depending on whether the date from 7 days earlier should be excluded or included.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-find-current-week-in-SAS/m-p/375358#M89977</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-12T15:13:34Z</dc:date>
    </item>
  </channel>
</rss>

