Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Hausman instruments - transfer varying variable of one variable as column next to other variables


From   Nick Darson <nick.darson@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Hausman instruments - transfer varying variable of one variable as column next to other variables
Date   Fri, 7 Sep 2012 09:46:28 +1000

Ok, just figured out that the easiest way is to use merge (save the
region data as seperate list and then merge it with the "master data
base" matching week and product)!

Sorry, tried too long to look for replace/ foreach- things.... Maybe
someone else can use this in the future!

Cheers
Nick


On Fri, Sep 7, 2012 at 6:51 AM, Nick Darson <nick.darson@googlemail.com> wrote:
> Dear Statalist,
>
> I would like to create Hausman-instruments for the price variable in
> my data set, i.e., I use the price of one region as instrument for
> another region. Another difficulty is that the prices (and thus the
> IV) vary by week (not only by product). E.g., let’s say I have the
> following data set (for the sake of simplicity: 3 regions, 2 products
> and 2 weeks, see below). Now I want to create a column with the
> instrument Z (i.e., the prices of region 3 next to the values for the
> other 2 regions (they vary per product and week though). BTW: region 3
> data will not be included in the analysis, so no need to do this
> cross-over (i.e., I don’t need to use region 2 prices for region 3).
>
> My stata knowledge is quite limited – I am sure this should be
> feasible with loops and some matching function. I would appreciate any
> help, even just links to similar problems!
>
> Region  Product    week    price         Z
> 1               1               1      44       51
> 1               1               2       43      52
> 1               2               1       20      31
> 1               2               2       21      32
> 2               1               1       40      51
> 2               1               2       41      52
> 2               2               1       20      31
> 2               2               2       20      32
> 3               1               1       51
> 3               1               2       52
> 3               2               1       31
> 3               2               2       32
>
>
> Cheers
> Nick
>
> *
> *   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/

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