Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • creating "baseline" variables for all data set time points

    Hello,

    I'm fairly new to Stata(using version 13) and have been working on reshaping a dataset from wide to long in preparation for xtgee analysis.

    The issue I'm running into at the moment is that the data set consists of survey data collected at baseline and again 3-months later. However, some of the variables at baseline were only collected at baseline and not at time 2. I was under the impression that there was a way to generate the same baseline variables for time 2. Rather than just having missing baseline variables for time 2, the time 2 variables would be the "average" of the baseline variable. Can this be done? The example code I was given isn't working (see below):

    gen var_base =.
    replace var_base = basecoh if visit ==0
    egen var0 = mean(var_base), by (participant_id)

    Thanks
    Last edited by scastillo; 24 Jul 2014, 16:47.
Working...
X