Hi Arthur, my problem is more complex than that simple example, but this example give you an idea what I wwant to achieve. Read carefully: The idea is imputed only the missing value of the last visits with LOCF, the missing intermediate visits remaining missing, and the carried baseline (i.e week2) if it is missing remaining missing. In Bold face I show the visits need to be imputed with LOCF data new; input subjid week value; datalines; 1 Baseline 10 1 Week2 12 1 week8 14 1 week12 16 2 baseline 12 2 week2 4 2 week8 14 3 Baseline 13 3 week4 5 3 week12 2 4 baseline 1 4 week2 3 5 Baseline 3 5 Week2 5 5 week12 6 run; and I am looking for the want dataset: 1 Baseline 10 1 Week2 12 1 week8 14 1 week12 16 2 baseline 12 2 week2 4 2 week8 14 2 week12 14 3 Baseline 13 3 week4 5 3 week12 2 4 baseline 1 4 week2 3 4 week4 3 4 week8 3 4 week12 3 5 Baseline 3 5 Week2 5 5 week12 6 It is is a not easy problem I think, because you need to consider all the possible variations always keeepen imputed the last visits, and not the missing intermediate visisits, and the missing visits follow baseline. I hope it is more clear now. Thnaks a lot. V and the visit following
... View more