- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Kindly see the log below in image.. Not able to type as text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
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.