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.