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 table like the following:

Capture.JPG

 

 

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?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@d6k5d3 wrote:
Hey Reeza, Thanks!
I imported them as character.

Did you try the length method I suggested?

 

if length(dateTime) < 10 then delete;

 

 

View solution in original post

6 REPLIES 6
d6k5d3
Pyrite | Level 9

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.

Reeza
Super User

What is the data type of the first column?  


@d6k5d3 wrote:

I have a table like the following:

Capture.JPG

 

 

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
Pyrite | Level 9
Hey Reeza, Thanks!
I imported them as character.
Reeza
Super User

@d6k5d3 wrote:
Hey Reeza, Thanks!
I imported them as character.

Did you try the length method I suggested?

 

if length(dateTime) < 10 then delete;

 

 

d6k5d3
Pyrite | Level 9
Great! Worked just fine! Thank you very much! 🙂

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
  • 6 replies
  • 1057 views
  • 0 likes
  • 3 in conversation