Hans J. Baumgartner
>
> I've got a new data file which is stored in an odd way.
>
> I have imported the file using the command insheet-. As a
> result I have
> variable names v1 to v251. However, the first observation
> in v251 is the
> variable name for v1; the second observation in v251 is the
> variable
> name for v2; and so on. Observation 251 and thereafter is missing.
>
> I have tried:
> For num 1/250: rename vX v251 in X
>
> But the rename- does not allow the in- option.
>
To Stata, -rename ... in #- would make
no sense. A variable is a column and
could not have different names in
different rows.
You need something like this
forval i = 1/250 {
local new = v251[`i']
rename v`i' `new'
}
You can't do this with -for- for
reasons explained at
http://www.stata.com/support/faqs/lang/macros.html
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/