Noob here.

I'm trying to create an age variable by using DEMO.L4, which is a string variable containing the year of birth. I only want the calculation to happen if DEMO.L4 does not = 9999 and then assign 99 to those that were 9999.
Below is what I have but it is not working. Everything seems to be fine until I type ENDIF, then the whole formula changes to black text.
IF [DEMO.L4]== 9999 THEN 99
ELSE DateTimeDiff(DateTimeToday(),[DEMO.L4],'years') ENDIF
I did some research and I think the issue might be that DEMO.L4 is a string variable and/or that it is only a 4 digit year (no month or day). I did try using the DateTime parse tool to convert DEMO.L4 to a date format. I tried a custom format of 'yyyy' and tried 'yyyyMMdd' but still no luck.