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

Hi

I am running one program in the database. But getting error in log window as

Invalid (or missing) arguments to the DATEPART function have caused the function to return a missing value.

How to get rid of it.

proc sql;

create table x as

select m.case_id, m.case_num,datepart(p.pat_dob) as pat_dob format =date9.

from master as m,

(select case_id, pat_dob from patient p where length(pat_dob_partial) in (11,17)) p

where m.case_id = p.case_id;

quit;

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Is pat_dob actually a SAS datetime variable? You might want to check.

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

Is pat_dob actually a SAS datetime variable? You might want to check.

dash
Obsidian | Level 7

Yes,

pat_dob is a datetime variable.

What can I do. Please suggest

art297
Opal | Level 21

First, remove the correct and helpful statuses of your and my posts .. your question has not been answered.

I didn't ask if it was a datetime variable but, rather, whether it was a SAS datetime variable.  Often people import data that contains a datetime variable, but the variable ends up in a SAS dataset as a character variable.  If you run the following:

proc contents data=master;

run;

what kind of variable does the system indicate pat_dob is?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1921 views
  • 3 likes
  • 2 in conversation