Bookmark and Share

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

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

Re: st: Creating new variable from existing observations

From   Suryadipta Roy <>
Subject   Re: st: Creating new variable from existing observations
Date   Sat, 9 Jun 2012 13:47:45 -0400

Nick and fellow Statalisters,
Please forgive my inadvertent previous post. It went out by accident!
I followed up on Nick's advice on my original query and have obtained
mostly satisfactory results. I will work on whatever glitches remain.

I actually had another question relating to replacing missing
observations for panel data. My original dataset has been sorted by
exporter, importer, and year. I am trying the following to replace
missing observations for a variable for both importer and exporter by
a following value for one/more years:

by importer exporter (year), sort: replace myvar = myvar[_n+1] if myvar >= .

However, this only replaces the value for one previous year and leaves
the rest unchanged. Can anyone let me know how to fix this problem and
replace the missing value for all previous years for all exporters and

Once again, my most sincere apologies for the previous slip!

Best regards,
*   For searches and help try:

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