We want a null or missing condition rather than a zero.
Here is the code: SET ALL = PASS JOIN PIN IN EMPDATA TO ALL PIN IN TRAINING END -* DEFINE FILE EMPDATA HDATE/MDYY MISSING ON = DATECVT(HIREDATE,'A8YYMD','MDYY'); SDATE/MDYY MISSING ON = DATECVT(COURSESTART,'A8YYMD','MDYY'); DAYS/D9.1 MISSING ON NEEDS ALL DATA = DATEDIF(SDATE,HIREDATE,'D'); END -* TABLE FILE EMPDATA PRINT PIN DEPT HIREDATE COURSESTART COURSECODE DAYS ON TABLE HOLD AS HOLD1 END -* TABLE FILE HOLD1 COMPUTE AVE.DAYS BY DEPT END
For pin #30 coursecode #NAMA730 we are getting the null condition correctly since a record does exist in the child table. However, for pin #20, since there is no child record the cooursestart is "populating" with a zero giving us an incorrect DAYS difference. How can we get the zero to be a null so that our DAYS calculate properly?This message has been edited. Last edited by: <Kathryn Henning>,
I don't think I understand correctly what exactly you need. The sample output you attached is also very hard to read due to the font size being used. Please edit your post and enclose your code and "desired result" in CODE tags.
Anyway, run this code and analyze the resulting data:
SET ALL = PASS
JOIN PIN IN EMPDATA TO ALL PIN IN TRAINING
END
-*
DEFINE FILE EMPDATA
HDATE/MDYY MISSING ON = DATECVT(HIREDATE,'A8YYMD','MDYY');
SDATE/MDYY MISSING ON = DATECVT(COURSESTART,'A8YYMD','MDYY');
DAYS/D9.1 MISSING ON NEEDS ALL DATA = DATEDIF(SDATE,HIREDATE,'D');
END
-*
TABLE FILE EMPDATA
PRINT
EMPDATA.PIN AS 'E_PIN'
TRAINING.PIN AS 'T_PIN'
DEPT
HIREDATE
COURSESTART
COURSECODE
DAYS
WHERE EMPDATA.PIN EQ '0000000$$'
END
Short-path (missing child record) entries are highlighted in the output and I can see that both COURSESTART and DAYS have a correct missing value in those cases. Where exactly are you seeing a "zero" value instead?
This has been solved. We believe this was happening because the source table was SQL. When we saved the data to a focus hold table and then did the join the date fields populated with blanks properly.