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

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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