I have a dataset with ID and grouping variable (treatment type), within grouping variable is a date (stopping date) but in some rows missing (every row is a doctor`s visit), how to copy this date to all rows if available within grouping variable and ID so that for each row I know the stopping date of this certain treatment?
I have tried mipolate and
bysort ID grouping_variable: replace stop_date = stop_date[_n-1] if missing(stop_date) But nothing
I have tried mipolate and
bysort ID grouping_variable: replace stop_date = stop_date[_n-1] if missing(stop_date) But nothing

Comment