Hi,
I want to check whether sales date is greater than current date or not. How can I do
I have written using oracle sqlra
select sales_date, sysdate from sales
where sales_date >sysdate
How to write in sas
You could use today():
proc sql;
select sales_date format=mmddyy10.
from sales
where sales_date>today();
quit;
You could use today():
proc sql;
select sales_date format=mmddyy10.
from sales
where sales_date>today();
quit;
Thanks linin for your great help
Right.
Or use the system macro variable &SYSDATE9.
where sales_date > "&SYSDATE9"d;
which may return a different value from the TODAY() function, since it contains the date that the SAS job/session began executing.
TODAY function will return the actual date.
More on TODAY function here:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000245961.htm
And SYSDATE9 here:
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000489470.htm
Cheers from Portugal.
Daniel Santos @ www.cgd.pt
Or date().
Haikuo
Just curious ... do we know for sure that SALES_DATE is actually a date rather than a datetime? After all, this data appears to be coming from Oracle.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.