Hi Guys
Need your expertise. facing an problem while using Date condition in where clase. i want the data from 1st of May
PROC SQL;
CREATE TABLE WORK.QUERY_FOR_dummy AS
SELECT t1.billingdate
FROM test.dummy t1
WHERE t1.billingdate >= '01May2016'd;
QUIT;
The output was from 5th of Jan.
the value is stored as date in the billingdate field. if i run a sql query in query builder the output is from 1st of may. only when i use SAS EG am facing this problem.
Please note - if i give WHERE t1.billingdate >= '05JAN2016'd; in this way am getting results from 1st of May.
can you guys please suggest what is the correct format to use.
It is interesting problem. If you can share the result of proc contents data=test.dummy; run;
I am interested to know details of the column type.
Please post the log, including the sql step code.
if you can share billing date column data type and its format.
Then it would help to answer.
Alphabetic List of Variables and Attributes | ||||||
# | Variable | Type | Len | Format | Informat | Label |
22 | archflag | Num | 8 | 6 | 6 | archflag |
4 | batchserno | Num | 8 | 11 | 11 | batchserno |
5 | billingdate | Num | 8 | DATE9. | DATE9. | billingdate |
What do you get when you run
data query_for_dummy1;
set test.dummy (keep=billingdate);
where billingdate >= '01May2016'd;
run;
(if you get dates before May 2016, once again post the log)
@yog_pals wrote:
Still the same result. output coming from 5th Jan 2016. do we have to change the SAS date format or system date format. now it is setup as US Date (system Date)
No, you don't have to change the settings. SAS date constants and date values are not affected by the system's settings.
next piece of test code:
data query_for_dummy;
set test.dummy (keep=billingdate);
where billingdate = '01May2016'd;
run;
proc sort data=query_for_dummy;
by billingdate;
run;
data _null_;
set query_for_dummy (obs=1);
put billingdate=;
run;
and post the log of this
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.