I have a table like the following:
The first two rows do not comply with the requirement as they do not show time. How can I select the 2 rows and delete afterward on SAS?
Thanks in advance?
@d6k5d3 wrote:
Hey Reeza, Thanks!
I imported them as character.
Did you try the length method I suggested?
if length(dateTime) < 10 then delete;
Please do not post data in pictures, use data steps with datalines.
A therefore untested solution:
data want;
set have;
if countw(date_time) = 1 then delete;
run;
Hello Kurt,
I am sorry for that.
However, I tried your code. But no rows got deleted.
I imported the Date_time as: informat Date_Time $21. ; format Date_Time $21. ; input Date_Time $;
Any other thoughts?
I appreciate your time. Thank you.
What is the data type of the first column?
@d6k5d3 wrote:
I have a table like the following:
The first two rows do not comply with the requirement as they do not show time. How can I select the 2 rows and delete afterward on SAS?
Thanks in advance?
You could just check the length of it if it's a character and if the length is less than whatever it should be, then delete the record.
@d6k5d3 wrote:
Hey Reeza, Thanks!
I imported them as character.
Did you try the length method I suggested?
if length(dateTime) < 10 then delete;
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!
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.