I have a table of records with a Start Date and an Entered Date (SOENTD). I have the below case statement to populate a field based on the the START_DT values or lacktherof. Problem is that the Nul Start Dates are not being registered and are defaulting to 'Existing' when they should be 'N/A'
Do I need to use Coalesce in this to do what I need it to? Any help is appreciated. Thank You!
proc sql;
update TBL_EX
set DATA_IND = case when START_DT >= SOENTD then 'New'
when START_DT < SOENTD then 'Existing'
when START_DT is null then 'N/A'
end;
quit;
case when START_DT >= SOENTD then 'New'
when START_DT < SOENTD and not missing(start_dt) then 'Existing'
when START_DT is null then 'N/A'
end
Missing values are considered to be less than non-missing values, that's why your original code doesn't work. It has nothing to do with the fact that the variables contain date values.
case when START_DT >= SOENTD then 'New'
when START_DT < SOENTD and not missing(start_dt) then 'Existing'
when START_DT is null then 'N/A'
end
Missing values are considered to be less than non-missing values, that's why your original code doesn't work. It has nothing to do with the fact that the variables contain date values.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.