Hi everyone,
I have a problem filtering a date based on the format new_date monyy5.;
I have variables that have that format and I want to pull the data based on the month that they land on.
I tired to do something like this
data X;
set Y;
where new_date='SEP19'd;
run;
keeps telling me that I have an invalid date/time/datetime constant - why is that?
Because you need to use the underlying value, not the formatted value.
Or convert to the formatted value.
data X;
set Y;
where put(new_date, monyy5.)='SEP19';
run;
@sasxii wrote:
Hi everyone,
I have a problem filtering a date based on the format new_date monyy5.;
I have variables that have that format and I want to pull the data based on the month that they land on.
I tired to do something like this
data X;
set Y;
where new_date='SEP19'd;
run;
keeps telling me that I have an invalid date/time/datetime constant - why is that?
underlying value?
so I tried using that as well which was a datetime. format - which consisted of
data X;
set Y;
if DATE >= '01SEP19:20:55:00'd and DATE <= '30SEP19:20:55:00'd;
run;
and it doesnt pull up anything, why would that be the case?
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.