Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: change value an old variable


From   [email protected]
To   [email protected]
Subject   Re: st: RE: change value an old variable
Date   Mon, 04 Dec 2006 16:20:13 +0100

thanks a lot
I try to do this:
by sort id country: replace var=var[_n+1] if year==1

is it the same?

now try with your help.
best

Quoting Scott Merryman <[email protected]>:

bysort id (year):replace var = var[2] if _n == 1 & mi(var)

Scott


-----Original Message-----
From: [email protected] [mailto:owner-
[email protected]] On Behalf Of [email protected]
Sent: Monday, December 04, 2006 8:27 AM
To: [email protected]
Subject: st: change value an old variable

Dear All,
  I have a variable in a panel that in first year is missing for each
value. I want to swap this variable by the value of the variable in
second year? How do it in stata? i try with generate and replace but
not function.
Thanks a lot for your help
Catia


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/




*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index