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;
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.