I need some programming advice with a repeated measures dataset in long format. There are some exposure variables (e.g., "arrested") that were only measured at baseline (i.e., survey=1) and appear as missing values at other timepoints (i.e., survey 2-5). I would like to use the baseline measurement across the other timepoints. What is the best way to do that? Here's a sample of the current dataset: caseid survey arrested 101 1 1 101 2 . 101 3 . 101 4 . 101 5 . 201 1 0 201 2 . 201 3 . 301 1 1 301 2 . 301 3 . 301 4 . 401 1 0 401 2 . 501 1 0 And here is what I would like it to look like: caseid survey arrested 101 1 1 101 2 1 101 3 1 101 4 1 101 5 1 201 1 0 201 2 0 201 3 0 301 1 1 301 2 1 301 3 1 301 4 1 401 1 0 401 2 0 501 1 0 Other things to know about the dataset: cases (caseid) have different numbers of observations, ranging from 1-5 this is one example with "arrested" as the variable that was only measured at baseline, but there are many other variables like this
... View more