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

I am trying to calculate age of newborns between date of birth and an exam date in weeks or months. 

I tried using this statement:

if DOB NE . and EXAMDATE ne . then do;

AGE_AT_EXAM= intck(‘month’,DOB,EXAMDATE());

RUN;

 

But I receive the following error messages. What am I doing wrong?                      

ERROR 386-185: Expecting an arithmetic expression.

ERROR 200-322: The symbol is not recognized and will be ignored.

ERROR 76-322: Syntax error, statement will be ignored.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
EXAMDATE() - why the brackets? That makes SAS think it's a function. Remove the brackets and it will resolve as a variable.

You also want to use the C option in that function I believe, check the documentation for the fourth parameter which you have not specified.

View solution in original post

3 REPLIES 3
Reeza
Super User
EXAMDATE() - why the brackets? That makes SAS think it's a function. Remove the brackets and it will resolve as a variable.

You also want to use the C option in that function I believe, check the documentation for the fourth parameter which you have not specified.
TLAM
Calcite | Level 5
I removed the brackets, and added the 'C' function for the continuous method, and I still get the same error messages.
Here is the revised code:
if DOB NE . and EXAMDATE ne . then do;
AGE_EXAM_MO= intck(‘MONTH’,DOB,EXAMDATE,'C');
FORMAT CHILDDOB AGDEXAMDATE MMDDYY10.;

And this is the error message:
8643 DATA EXAMAGE;
8644 SET MERGEDOB;
8645 /*CREATE AGE AT EXAM*/
8646 if DOB NE . and EXAMDATE ne . then do;
8647 AGE_EXAM_MO= intck(‘MONTH’,DOB,EXAMDATE,'C');
-
386
200
76
ERROR 386-185: Expecting an arithmetic expression.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 76-322: Syntax error, statement will be ignored.
TLAM
Calcite | Level 5
Nevermind, I realize the error. I tried using double quote rather than single quote, and that worked.
Thank you so much!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 1291 views
  • 1 like
  • 2 in conversation