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.
try
if day="Fri" and '9:00:00't<Time<'11:00:00't then ssss=aa;
this assumes aa is variable name
try
if day="Fri" and '9:00:00't<Time<'11:00:00't then ssss=aa;
this assumes aa is variable name
You were close, you must use time literals :
if day="Fri" and '9:00:00't<Time<'11:00:00't then ssss=aa;
@PGStats Sir, it's nothing to hide that I adore you, but we seem to have a great connection. 🙂 like last night.
Cheers! ![]()
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.