04-17-2017 10:59 AM
I apologize if this has been answered - I could not find the post I did Friday.
I have a function I have used for years successfully to calculate age. It's
T1.DATEBEGIN_AT_CLO) - (day (T1.DATEBEGIN_AT_CLO) < day (T1.DATEOFBIRTH)))/12) )
Where I want to calculate age at datebegin_At_Clo .The problem here is that I am starting with a date stored as a text field (I did not generate it the federal government does and I do not know how they formatted it except that it is a string).
It is of the form '19761026' where the first four digits are the year, the next two the month and the next two the days.
CREATE TABLE WORK.QUERY_FOR_Q16 AS
/* DOB */
(INPUT(t1.DateOfBirth, yyyymmdd10.)) LABEL="DOB" AS DOB,
/* CD */
(INPUT(t1.ClosureDate, yyyymmdd10.)) LABEL="CD" AS CD
FROM WORK.Q16 t1;
and it appears to generate a number fine. However when I use the new fields (DOB and CD) in the age function above I get no results (not errors just no results).
That is I get only missing data for Age when I run
CREATE TABLE WORK.QUERY_FOR_Q16_0000 AS
/* Age */
T1.cd) - (day (T1.cd) < day (T1.Dob)))/12) )
) LABEL="Age" AS Age
FROM WORK.QUERY_FOR_Q16 t1;
04-17-2017 11:06 AM
Several responses in
Note that if you click on your user name in the upper right it will bring you to a profile page with links to your most recent posts.