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.
Nick
n.j.cox@durham.ac.uk
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
problem?
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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/