Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Create baseline variable within panel data


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Create baseline variable within panel data
Date   Sat, 20 Jul 2013 23:08:20 +0100

bysort id (time) : gen newvar = outcome[1]

Nick
[email protected]


On 20 July 2013 21:44, Nikolaos Pandis <[email protected]> wrote:

> I have 5 observations per patient which indicate outcome measurements at 5 different time points including baseline.
> I have reshaped my data long and I would like to generate a new variable which is populated for each patient id (5 instances) with the baseline outcome value (yi1) as shown below:
>
> id outcome time  new_var
>
> 1   y11      1     y11
> 1   y12      2     y11
> 1   y13      3     y11
> 1   y14      4     y11
> 1   y15      5     y11
> 2   y21      1     y21
> 2   y22      2     y21
> 2   y23      3     y21
> 2   y24      4     y21
> 2   y25      5     y21
> 3.........................
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index