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

Re: Re: Re: st: RE: RE: Changes of the dataset

From   n j cox <>
Subject   Re: Re: Re: st: RE: RE: Changes of the dataset
Date   Wed, 05 Oct 2005 13:41:43 +0100

My original solution was overkill, although it worked.

gen long newid = _n
reshape wide price, i(newid) j(buyer) string
renpfix price
drop newid

is a simpler solution. The criterion is that the
variables in -i()- uniquely identify the observations.
Here this is true by construction.

My last comment on my previous posting still stands.


I.A.C. van de Snepscheut

You understood my problem very well the first time, your output was
exactly what I wanted to have. Only I made my example a litte bit
simpler with less variables. You must think of the same situation only
the variables are not only price colour age id and buyer, but also a
couple of other variables (in total something like 30 variables). I
put all my variables between the brackets after i (just like you did)
and than stata gave an error. The number of variabeles is too high.
Than I tried and the maximum number of variables appeared to be 10, so
that is a problem. Now my question was do you have a solution for this

n j cox

> Sorry, I thought that I understood what your problem was.
> Now that you have changed the problem to this vaguer
> one I don't have a clear enough picture to advise, except
> in a backwards manner: if your data don't allow a -reshape-
> solution, that may not really be a good idea.
> It seems entirely possible that your original data structure
> may in fact be best overall for what you want to do. You
> just need to get fluent with -by:-, -collapse- and some other
> commands.
*   For searches and help try:

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