Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Reshape like problem


From   Pancho Villa <[email protected]>
To   [email protected]
Subject   st: Reshape like problem
Date   Thu, 4 Jun 2009 14:15:35 -0400

Dear list,

I have my data in this kind of form:

id	value
1	15
2	14
3	22
4	31
5	12
6	10

id_1	id_2	value
1	1	15
1	2	14
1	3	22
2	1	31
2	2	12
2	3	10

In other words, my data is stacked and would like to un-stack it.  (I
can do reshape, I think.  But this seems like a necessary first step.)

Now, in my example, my id goes from 1 to 6, while I'd like id_1 to go
from 1 to 2 and id_2 from 1 to 3.   In reality, my id goes from 1 to
5084280, while I want id_1 to go from 1 to 2088 and id_2 from 1 to
2435.  (If you check, 2088 x 2435 = 5084280.)

I'll really appreciate if you can share code addressing a very similar
problem so I can just paste it in my do file and tweak a few things.

Thanks in advance,

PV
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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