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;
Do you really think @Raj00007 has a variable named
10JUN2010
?
The proper character for a date literal is d:
'10JUN2010'd
T
data flightdelays;
set lib.flightdelays;
if Date < '10JUN2010'n;
run;
proc print;
run;
@TarunKumar wrote:
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
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.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch 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.