Hi,
i have variable (Date) with dates such as 01MARCH2010 till 12 DEC2011.
How do i get only variables less than 10JUN2010. iam trying with this code, but it's not executing properly.
data flightdelays;set lib.flightdelays;where Date < 10JUN2010;run;proc print;run;
@TarunKumar wrote: T data flightdelays;set lib.flightdelays;if Date < '10JUN2010'n;run;proc print;run;
T
data flightdelays;set lib.flightdelays;if Date < '10JUN2010'n;run;proc print;run;
Do you really think @Raj00007 has a variable named
10JUN2010
?
The proper character for a date literal is d:
'10JUN2010'd
View solution in original post
Use a correct date literal:
data flightdelays; set lib.flightdelays; where Date < '10JUN2010'd; run;
You do not need to create a separate dataset, though; WHERE statements (or WHERE= dataset options) can be used in most procedures.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.Sign up by Dec. 31 to get the 2024 rate of just $495.Register now!
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.