07-14-2016 08:54 AM
Hi Guys, I'm new to SAS (EG 9.3) and very new here...please be gentle and use simple words!
I have inherited some code that is ran each morning, with the date manually changed each day. I want to automate this code, so i am trying to change the manual date to today(), so it doesn’t need any user input.
if i take the where...Today() statement out, i get all the dates, when i put it back in i don’t get any observations.
Thanks in advance for nay help given,
create table work.alerts_daily as
where description like 'Alert1' or description like 'Alert2' or description like 'Alert3';
create table LN_Alert_DAY as
select distinct a. *,
from work.alerts_daily as
a inner join work.customer_status2 as b
on a. CustomerNumber = b. ID
order by intID;
create table work.LN_Alert_DT as
select * from LN_Alert_DAY
where Datecreated = today();
07-14-2016 09:19 AM
What did your manual date look like?
Most likely the variable datecreated isn't a SAS date which is what you're expecting. It could either be a character variable or a date time variable. Check the variable type and format for the DateCreated variable.
07-14-2016 09:37 AM
That's a date time variable, not a date variable.
You can use the following instead of just today() to create a date time variable.
DateCreated = dhms(today(), 0, 0,0)
Or you could use datepart function to change dateCreated to a date variable.
Need further help from the community? Please ask a new question.