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

I have a dataset as the one below:

 

Date           Day      Time       yyy   zzz

3/17/2009   Fri        9:00:00    12    34

5/18/2013   Fri        10:00:00  23    34

7/21/2007   Fri        11:45:00  45    56

…..……………………………..

 

Now, I would like to filter data with Time. The Time is in NUM time20. format. I would like to do this:

 

if day is FRI and time between 9:00:00 and 11:00:00 then ssss=aa;

 

I coded as: if day="Fri" and 9:00:00<Time<11:00:00 then ssss=aa; which gives an error and asks for arithmetic operator.

 

I need your help!

 

Much thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

try

if day="Fri" and '9:00:00't<Time<'11:00:00't then ssss=aa;

this assumes aa is variable name

View solution in original post

4 REPLIES 4
novinosrin
Tourmaline | Level 20

try

if day="Fri" and '9:00:00't<Time<'11:00:00't then ssss=aa;

this assumes aa is variable name

PGStats
Opal | Level 21

You were close, you must use time literals :

 

 if day="Fri" and '9:00:00't<Time<'11:00:00't then ssss=aa;

PG
novinosrin
Tourmaline | Level 20

@PGStats  Sir, it's nothing to hide that I adore you, but we seem to have a great connection. 🙂 like last night. 

PGStats
Opal | Level 21

Cheers! Smiley Wink

PG

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 868 views
  • 3 likes
  • 3 in conversation