Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Tomáš Houška <xbender@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: shifting data inside panel data |
Date | Fri, 4 May 2012 09:37:55 +0200 |
Dear Statalist, I have panel data of the following structure: "Store - Week - Product_ID - Price - Quantity". Where there are multiple week data for each store and multiple products being sold in each store every week. Overall I have 36 stores, 28 products and 220 weeks, the data are in a long format. The dataset is symmetric - all products were sold in every store and in every week. I am trying to create a new variable (lets call it "price_iv"), which will be an instrumental variable for my demand analysis. I would like the variable to contain for each product in each week prices from a different store - i.e. I would like to shift the price data in the "price" variable in such a way, that price of a product 1 in week one and store 1 will correspond to the prices of product 1 in week in and store 2 (or any other). Optimally each store will be used only once - so at the end the data from all stores would be assigned to a different store. I havent been able to come up with a way, how to shift the data in an appropriate way - Can you please help me solve this problem? Thank you ! Tomas * * 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/