<?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 of today() between in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819956#M323621</link>
    <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have never used BETWEEN in that way. So then it would be correct to say BETWEEN is valid in WHERE statements/clauses?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The following doesn't work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    set sashelp.class;
    if age between 14 and 15 then age_14_15_flag=1;
    else age_14_15_flag=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jun 2022 11:53:18 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-06-23T11:53:18Z</dc:date>
    <item>
      <title>Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819936#M323614</link>
      <description>&lt;P&gt;Can someone help me understand the meaning of this SAS code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;today() between Start_dt and End_dt&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2022 10:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819936#M323614</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2022-06-23T10:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819941#M323616</link>
      <description>&lt;P&gt;The today() function returns a SAS Date value representing the current date (numerical value; count of days since 1/1/1960)&lt;/P&gt;
&lt;P&gt;SAS variables start_dt and end_dt must also contain SAS Date values&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This expression returns TRUE if the value for today() is &amp;gt;= start_dt and &amp;lt;= end_dt&lt;/P&gt;
&lt;P&gt;Another way to write the expression would be: start_dt &amp;lt;= today() &amp;lt;= end_dt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope that explains it to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't understand how SAS Date, DateTime and Time values work then I'd strongly recommend some "Googling" to find the relevant SAS documentation. It's important that you do understand this and it's explained in detail in the SAS docu.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 10:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819941#M323616</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-06-23T10:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819948#M323618</link>
      <description>&lt;P&gt;Adding to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;'s explanation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BETWEEN can only be used in PROC SQL, not elsewhere in SAS.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 11:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819948#M323618</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-23T11:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819955#M323620</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say where clause given below syntax is also valid in SAS data steps.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  start_dt=today()-10;
  end_dt=today()+10;
run;

data demo_1;
  set have(where=(today() between start_dt and end_dt));
run;

data demo_2;
  set have;
  where today() between start_dt and end_dt;
run;

proc sql;
  create table demo_3 as  
  select *
  from have
  where today() between start_dt and end_dt
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2022 11:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819955#M323620</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-06-23T11:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819956#M323621</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have never used BETWEEN in that way. So then it would be correct to say BETWEEN is valid in WHERE statements/clauses?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The following doesn't work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    set sashelp.class;
    if age between 14 and 15 then age_14_15_flag=1;
    else age_14_15_flag=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2022 11:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/819956#M323621</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-06-23T11:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/820017#M323637</link>
      <description>Thanks for solution..</description>
      <pubDate>Thu, 23 Jun 2022 13:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/820017#M323637</guid>
      <dc:creator>garkbeda43</dc:creator>
      <dc:date>2022-06-23T13:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Understanding of today() between</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/820181#M323711</link>
      <description>&lt;P&gt;Basically WHERE clauses mimic SQL functionality.&amp;nbsp; So you use use BETWEEN and LIKE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If suspect it is so all of the code that SAS uses to do implicit pass thru to remote SQL databases can be reused in processing WHERE clauses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that some things that SQL does not support the WHERE clause does.&amp;nbsp; Like colon modifier on comparison operators.&lt;/P&gt;
&lt;PRE&gt;1520  proc print data=sashelp.class;
1521    where name =: 'A' ;
1522  run;

NOTE: There were 2 observations read from the data set SASHELP.CLASS.
      WHERE name=:'A';
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


1523
1524  proc sql;
1525    select * from sashelp.class
1526    where name =: 'A'
                    -
                    22
                    200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
              a missing value, (, *, +, -, ALL, ANY, BTRIM, CALCULATED, CASE, INPUT, PUT, SELECT, SOME, SUBSTRING, TRANSLATE,
              USER.

ERROR 200-322: The symbol is not recognized and will be ignored.

1527    ;
1528  quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 02:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Understanding-of-today-between/m-p/820181#M323711</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-24T02:55:44Z</dc:date>
    </item>
  </channel>
</rss>

