Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: insert obs of one file at the beginning of another file


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: insert obs of one file at the beginning of another file
Date   Fri, 22 Nov 2002 19:22:31 -0000

Daniel M�ller
>
> I would like to insert observations (format: %12s) of one
> variable of a file with 10 obs <head.dta> at the beginning
> of several variables (converted to strings) of another file
> <boss.dta> and shift the remaining observations from
> <boss.dta> these 10 obs back. I appended <head.dta> to
> <boss.dta>, then replaced every empty observation at the end
> of <boss.dta>. But here I get stuck. How can I efficiently
> put the string variables from the end to the beginning?
>
> P.S.: Speed is an issue as <boss.dta> has 1.7 mio obs!


In the last sentence, Daniel means "observations" not
variables (pers.comm.).

gen long which = cond(_n <= 10, _N + _n, _n)
sort which

Nick
[email protected]

*
*   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