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

st: Re: Reorganize data in STATA


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: Reorganize data in STATA
Date   Tue, 7 Dec 2004 22:22:20 -0500

check out -reshape-. Something like:

reshape wide price, i(week) j(product) string

should do it. You may first want to rename price to price_ if you want the new price vars to be price_a price_b etc.. instead of pricea priceb...

Michael Blasnik
[email protected]


----- Original Message ----- From: "MA V" <[email protected]>
To: <[email protected]>
Sent: Tuesday, December 07, 2004 9:34 PM
Subject: st: Reorganize data in STATA



Hi,
I am using Stata 8.0 for Windows.
My problem is the following:

Suppose we have a list with product prices per week like this:

Product week price
a 1 $2
a 2 $2.2
... .... ...
a T $2.1
b 1 $3
b 2 $2.8
... .... ...
b T $2.9

(where we have only one price and week per product and the number of weeks - T- is the same for all products)

Is it possible to create a table(file) where the number of rows is the # of weeks and the number of columns is the number of products and we have the prices series for each product listed "vertically"?, i.e, something like:

price_a price_b price_c
1 $2 $3 ....
2 $2.2 $2.8 ...
...
T $2.1 $2.9 ....

Is there an easy way to do this in STATA?
I would really appreciate some help on this...
Thanks,
MA

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