Data sv ;
input cpevent$1-8 svstdt $9-18 ;
patient = "1015";
cards ;
week0 20apr2022
week4 18may2022
week8 20jun2022
week26 19oct2022
week30 22nov2022
week34 14dec2022
week52 18apr2023
week56 17may2023
week60 19jun2023
week78 17oct2023
week82 15nov2023
week86 13dec2023
week104 17apr2024
;
Data qs ;
patient = "1015";
do qsdat = '22apr2022'd to '25apr2022'd,'18may2022'd to '20may2022'd,
'21jun2022'd,'19oct2022'd to '22oct2022'd,'14dec2022'd to '17dec2022'd,
'18apr2023'd to '21apr2023'd ,'17may2023'd to '19may2023'd,'19jun2023'd to '21jun2023'd,
'19oct2023'd to '22oct2023'd,'15nov2023'd to '18nov2023'd,
'13dec2023'd to '16dec2023'd,'18apr2024'd ;
output;
end ;
format qsdat date9.;
run; I need help in programming for below condition. Iam created above data based on my real time project. Required output dataset also attached. Output same as attached Dataset below. for the svstdt check the below logics : 1)for day0 check if qsdat = svstdt ,if yes populate the qsdat inday0 column. keep lt blank 2)for day1 check if qsdat = svstdt+1 ,if yes populate the qsdat in day1 column. keep lt blank 3)for day2 check if qsdat = svstdt+2 ,if yes populate the qsdat in day2 column. keep lt blank 4)for day3 check if qsdat = svstdt+3 ,if yes populate the qsdat in day3 column. keep lt blank if any columns from day0 ,day1,day2,day3 is blank then populate flag as "missing" if additional records were received in qsdat which is outside of above defined days (day1,day1,day2,day3)
... View more