<?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 Using today in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853186#M37520</link>
    <description>&lt;P&gt;I was working on a dataset in SAS and I want to filter out data based on date. So right I am using this as a code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data want;
set have;
where ('09JAN2023'd &amp;lt;= DATE_OF_APPROVAL &amp;lt;= '10JAN2023'd);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, I want to use today as a function to do the above task so that everyday when I run code it takes the below logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;where ((today()-2) &amp;lt;= DATE_OF_APPROVAL &amp;lt;= (today()-1));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;(the logic is based on today's date like if today is 11JAN2023 it should bring date of 09JAN2023 and 10JAN2023).&lt;/P&gt;&lt;P&gt;I just want guidance in approaching this problem.&lt;/P&gt;&lt;P&gt;Is this possible somehow in SAS. Please, help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jan 2023 05:23:18 GMT</pubDate>
    <dc:creator>Kirito1</dc:creator>
    <dc:date>2023-01-11T05:23:18Z</dc:date>
    <item>
      <title>Using today</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853186#M37520</link>
      <description>&lt;P&gt;I was working on a dataset in SAS and I want to filter out data based on date. So right I am using this as a code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data want;
set have;
where ('09JAN2023'd &amp;lt;= DATE_OF_APPROVAL &amp;lt;= '10JAN2023'd);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now, I want to use today as a function to do the above task so that everyday when I run code it takes the below logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;where ((today()-2) &amp;lt;= DATE_OF_APPROVAL &amp;lt;= (today()-1));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;(the logic is based on today's date like if today is 11JAN2023 it should bring date of 09JAN2023 and 10JAN2023).&lt;/P&gt;&lt;P&gt;I just want guidance in approaching this problem.&lt;/P&gt;&lt;P&gt;Is this possible somehow in SAS. Please, help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 05:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853186#M37520</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-01-11T05:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using today</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853188#M37521</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I was working on a dataset in SAS and I want to filter out data based on date. So right I am using this as a code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data want;
set have;
where ('09JAN2023'd &amp;lt;= DATE_OF_APPROVAL &amp;lt;= '10JAN2023'd);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now, I want to use today as a function to do the above task so that everyday when I run code it takes the below logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;where ((today()-2) &amp;lt;= DATE_OF_APPROVAL &amp;lt;= (today()-1));&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;(the logic is based on today's date like if today is 11JAN2023 it should bring date of 09JAN2023 and 10JAN2023).&lt;/P&gt;
&lt;P&gt;I just want guidance in approaching this problem.&lt;/P&gt;
&lt;P&gt;Is this possible somehow in SAS. Please, help!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When in doubt try it:&lt;/P&gt;
&lt;PRE&gt;data have;
   input datevar :date9.;
   format datevar date9.;
datalines;
08Jan2023
09Jan2023
10Jan2023
11Jan2023
12Jan2023
13Jan2023
14Jan2023
;

data want;
   set have;
   where (today()-2) le datevar le (today()-1);
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 05:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853188#M37521</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-11T05:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using today</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853190#M37523</link>
      <description>It only is getting data on date of (today -2 )</description>
      <pubDate>Wed, 11 Jan 2023 06:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853190#M37523</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-01-11T06:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using today</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853191#M37524</link>
      <description>&lt;P&gt;Then you don't have dates for today()-1 in the dataset.&lt;/P&gt;
&lt;P&gt;From where do your dates originate? If you imported from Excel, your dates may have invisible time components (Excel stores times as fraction of a day, not as count of seconds, and has therefore only datetime values).&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 06:33:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853191#M37524</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-11T06:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using today</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853202#M37529</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;It only is getting data on date of (today -2 )&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;With the code shown above creating the data set and running on 11JAN2023 the result I get is&lt;/P&gt;
&lt;DIV class="branch"&gt;&lt;A name="IDX11" target="_blank"&gt;&lt;/A&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.WANT" cellspacing="0" cellpadding="3"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c m header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="c m header" scope="col"&gt;datevar&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;09JAN2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l m rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;10JAN2023&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are not getting such then perhaps you do not have a value in your set that your expect.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 11 Jan 2023 07:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853202#M37529</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-11T07:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using today</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853213#M37531</link>
      <description>Nah using it directly is working something like below.&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;where today()-3 &amp;lt;= DATE_OF_APPROVAL &amp;lt;= today();&lt;BR /&gt;run;&lt;BR /&gt;Thanks for the contribution. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 11 Jan 2023 09:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Using-today/m-p/853213#M37531</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-01-11T09:18:06Z</dc:date>
    </item>
  </channel>
</rss>

