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

Kindly see the below code

 

data PKMERGE;
set PKDAR;
/*Derivation of age*/
age=intck('year',VSN1D, DOB1D, 'Continuous'); /*Check the age*/
run;

The below log appears

NOTE: Invalid numeric data, ATLSMP1T='10:58' , at line 117
      column 15.
NOTE: Invalid numeric data, SMP1D='20MAR2006' , at line 117
      column 30

The image of data


 
Updating Media

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

The NOTEs about conversion from character to numeric indicate that you do not have date values (numeric, count of days starting at 1960-01-01), but strings that look like dates. You need to correct that when the dataset(s) that lead up to this are created.

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

The code you posted does not use any of the variables mentioned in the messages.

Please post the complete log of the actual step that caused the NOTEs you posted.

Tejaswini3
Obsidian | Level 7

Kindly see the log below in image.. Not able to type as text.

 

Tejaswini3_0-1646493164101.png

 

PaigeMiller
Diamond | Level 26

As the log clearly points out

 

ATLSMP1T='10:58'

in not a valid numeric value. Do you understand why?

 

However if you put a letter T after it, then it becomes a valid SAS time value.

 

ATLSMP1T='10:58't

However, looking at your code, you need to fix this in data set PKDAR, as we don't know how that was created.

 

In the future, please present your LOG as text and not as a screen capture. In the future, please include the text of your LOG in the window that appears when you click on the </> icon

2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png

--
Paige Miller
Kurt_Bremser
Super User

The NOTEs about conversion from character to numeric indicate that you do not have date values (numeric, count of days starting at 1960-01-01), but strings that look like dates. You need to correct that when the dataset(s) that lead up to this are created.

Tejaswini3
Obsidian | Level 7

Following log is seen

NOTE: Character values have been converted to numeric
      values at the places given by: (Line):(Column).
      266:18   266:25
NOTE: Invalid numeric data, VSN1D='18APR2006' , at line 266
      column 18.
NOTE: Invalid numeric data, DOB1D='08JUL1955' , at line 266
      column 25.

Kindly help in how to resolve

Sajid01
Meteorite | Level 14

Hello @Tejaswini3 
Looks like the format of the date variables DOBID and VSNID are not properly defined.
This can be clearly seen from the screen shot of the log you have posted. Once this is corrected, you should be able to calculate the age. Have a look at the example below and it should help.
Initially the variables DOB and VSD are character type. They are converted to date format and used.

data test (keep =name DOBID VSNID age);
length name $ 20 DOB VSD $9;
format DOBID VSNID date9.;
input name $ DOB $ VSD;
DOBID=input(DOB,date9.);
VSNID=input(VSD,date9.);
age=intck('year',DOBID, VSNID, 'Continuous');
dataline;
SOME_NAME 18JUL1955 18APR2006
;
run;

The output would be as follows

Sajid01_0-1646508476608.png

Make appropriate changes to suit your situation.

 Your question was on age calculation. I have focused on that. Other errors if any need to be appropriately addressed.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1288 views
  • 2 likes
  • 4 in conversation