BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Raj00007
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@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

View solution in original post

3 REPLIES 3
TarunKumar
Pyrite | Level 9

T

 

data flightdelays;
set lib.flightdelays;
if Date < '10JUN2010'n;
run;
proc print;
run;

Kurt_Bremser
Super User

@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
Kurt_Bremser
Super User

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.

SAS Innovate 2025: Register Now

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!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 3 replies
  • 845 views
  • 0 likes
  • 3 in conversation