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

st: Changes of the dataset


From   "I.A.C. van de Snepscheut" <Inez.vandeSnepscheut@student.uva.nl>
To   statalist@hsphsun2.harvard.edu
Subject   st: Changes of the dataset
Date   Wed, 05 Oct 2005 10:56:31 +0200

Hi!

I have a problem with my dataset. It is very huge, almost 400000 
lines. I want to change my dataset. It is sort of transposing a very 
big matrix. But the difference is that the columns with the same must 
be put together. To be clear is here a table how the situation is in 
small:

Buyer	Price buyer offers	Colour 	     Age     Product ID
X	10	                Yellow	      12	1
X	10	                Red	      16	2
Y	12	                Red 	      16	2
Z	13	                Red	      16	2
Z	15	                Blue	       4	3
Y	80	                Green	       1	4
H	6	                White	      20	5
H	10	                White	      20	5
X	14	                Red	      16	2

Wanted situation:

Product ID	Colour	Age	X	Y	Z	H
1	        Yellow	12	10	0	0	0
2	        Red	16	10	12	13	0
2	        Red	16	14	0	0	0
3	        Blue	4	0	0	15	0
4	        Green	1	0	80	0	0
5	        White	20	0	0	0	6
5	        White	20	0	0	0	10

Or

Product ID	Colour	Age	X	Y	Z	H
1	        Yellow	12	10	0	0	0
2	        Red	16	10	0	0	0
2	        Red	16	0	12	0	0
2	        Red	16	0	0	13	0
2	        Red	16	14	0	0	0
3	        Blue	4	0	0	15	0
4	        Green	1	0	80	0	0
5	        White	20	0	0	0	6
5	        White	20	0	0	0	10

Does anyone knows how to do this in stata? 

Inez
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index