Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: How to replicate


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: How to replicate
Date   Mon, 22 Feb 2010 11:37:07 -0000

See also 

How can I replace missing values with previous or following nonmissing
values or within sequences? 
http://www.stata.com/support/faqs/data/missing.html

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss


If "marital" (status) is regarded as time-invariant in your dataset:

*******
clear*

input byte ( Year ID edu marital)
1 1 10 1
2 1 . .
3 1 . .
4 1 . .
1 2 12 2
2 2 . .
3 2 . .
4 2 . .
1 3 8 1
2 3 . . 
3 3 . .
4 3 . .
end

list, noo sepby(ID)

bys ID (Year): replace edu=edu[1]
bys ID (Year): replace marital=marital[1]

list, noo sepby(ID)
*******

Hailemariam

I have a panel data set more than 9000 observation of the following
structure. But I want to replicate the first year values of the
time-invariant variables to the remaining years corresponding to each
ID. 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index