Hello All,
I'm a new SAS user attempting to fill in some missing dates in my dataset. I have visits and visit numbers with corresponding start and end dates. I have all visit information, but not all dates:
How can I add the missing dates based on visit without overwriting the existing ones? Also, gaps in dates are not consistent. Some subjects are missing one date, others are missing more. Any help would be appreciated!
I don't understand what you want your output to look like. Could you show what the output should look like, corresponding to the input you have provided?
Hello,
I'd my output to have all the missing dates filled in. If the last date is left off at 05Mar2020, then the next should be 06Mar2020, then 07Mar2020, then 08Mar2020, and so on until the next non-missing date. Hope this helps!
You have not provided a sas data step to reveal the names of your variables, and I am not going to make a data step out of your png file. So here goes, assuming your date variable names are DATE1 and DATE2:
data want;
set have;
date1=coalesce(date1,lag(date1)+1);
date2=coalesce(date2,lag(date2)+1);
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.