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]
st: RE: To expand the value of a constant variable across the panel
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: RE: To expand the value of a constant variable across the panel
Date
Thu, 1 Apr 2010 19:54:56 +0200
<>
*******
clear*
input byte( pid visit gender)
1 1 1
1 2 .
1 3 .
1 4 1
2 1 .
2 2 .
2 3 0
2 4 .
end
tempvar mymax
bys pid: egen `mymax'=max(gender)
replace gender=`mymax' if mi(gender)
list, noo sepby(pid)
*******
HTH
Martin
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Eduardo Nunez
Sent: Donnerstag, 1. April 2010 19:49
To: [email protected]
Subject: st: To expand the value of a constant variable across the panel
Dear statalisters,
I have longitudinal data where patients have information on several timepoints.
Some values from constant variables are missing. How should I fill in
these observations across the panel (pte id)?
Example:
pid visit# gender
1 1 1
1 2 .
1 3 .
1 4 1
2 1 .
2 2 .
2 3 0
2 4 .
etc..................
I did tried the ssc program "enlarge" but reported error when values
existed more than once (as in pte 1).
I would appreciate any help,
Eduardo
*
* 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/
*
* 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/