<?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 Get today data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668792#M200524</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can't get todays data.Please help.can we not call global macro in data step?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards;
input test$ date anydtdte.;
format date yymmddn8.;
cards;
a 20200713
b 20200713
c 20200707
d 20200708
e 20200709
uf 20200710
;
run;
%let today = %sysfunc(today(),yymmddn8.);
	%put "&amp;amp;today.";

data test;
set a;
if date=&amp;amp;today;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jul 2020 12:35:12 GMT</pubDate>
    <dc:creator>sathya66</dc:creator>
    <dc:date>2020-07-13T12:35:12Z</dc:date>
    <item>
      <title>Get today data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668792#M200524</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can't get todays data.Please help.can we not call global macro in data step?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards;
input test$ date anydtdte.;
format date yymmddn8.;
cards;
a 20200713
b 20200713
c 20200707
d 20200708
e 20200709
uf 20200710
;
run;
%let today = %sysfunc(today(),yymmddn8.);
	%put "&amp;amp;today.";

data test;
set a;
if date=&amp;amp;today;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668792#M200524</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2020-07-13T12:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get today data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668796#M200525</link>
      <description>&lt;P&gt;In most cases it is not a good idea to store formatted dates in macro-variables. This is one of those cases.&lt;/P&gt;
&lt;P&gt;In a data-step a format has no influence on the value stored in the dataset, the format only influences what you see.&lt;/P&gt;
&lt;P&gt;So please try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set a;
  if date = today();
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you really need today's date in a macro-variable don't use the second parameter of %sysfunc:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today = %sysfunc(today());&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668796#M200525</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-07-13T12:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get today data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668797#M200526</link>
      <description>&lt;P&gt;SAS is not recognizing your macro variable &amp;amp;today as a date. It is recognizing it as the number 20200713. Remove the format in your %sysfunc(today()) step, and it will return the number of days since 1/1/1960, which is 22109. SAS will recognize that as your date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
infile cards;
input test$ date anydtdte.;
format date yymmddn8.;
cards;
a 20200713
b 20200713
c 20200707
d 20200708
e 20200709
uf 20200710
;
run;

%let today = %sysfunc(today());
    %put &amp;amp;=today;

data test;
set a;
if date=&amp;amp;today;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 12:59:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668797#M200526</guid>
      <dc:creator>ketpt42</dc:creator>
      <dc:date>2020-07-13T12:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get today data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668800#M200527</link>
      <description>See Maxim 28.</description>
      <pubDate>Mon, 13 Jul 2020 13:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668800#M200527</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-13T13:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get today data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668809#M200529</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use the date format while defining the macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;%let today = %sysfunc(today(),yymmddn8.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put date=&amp;amp;today;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;And then when you are creating the dataset A, you have to mention the codition with input statment, because now the macro value is character and you are filtering the data as date value which a different datatype.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 13:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-today-data/m-p/668809#M200529</guid>
      <dc:creator>rabindrakumar1</dc:creator>
      <dc:date>2020-07-13T13:17:54Z</dc:date>
    </item>
  </channel>
</rss>

