|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Replace string values
At 01:54 PM 3/12/2008, Austin Nichols wrote:
Try
replace table=table[_n-1] if mi(table)
On Wed, Mar 12, 2008 at 1:42 PM, sdm1 <[email protected]> wrote:
> It's rather a coincidence but...how would you undertake the reverse
> operation?
[...]
If you do this sort of operation a lot, you may want to try -carryforward-.
Though, on second thought, for this particular example, table was
part of the key, and is partially lost. So, before you can run
-carryforward-, you need to reconstruct a key -- which is the same
as, or equivalent to restoring table. Notice that, once table has
been partially wiped out, the dataset is in a precarious state: there
is nothing to tie observations into appropriate groups aside from
their present order. That's the reason behind Nick's suggestion to
clone the table variable beforehand, and his warning about an
"injudicious sort" afterwards.
But for those who may be interested in carryforward, see...
ssc desc carryforward
ssc inst carryforward
HTH,
--David
*
* 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/