Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: Strmatch across rows
From 
 
"Lawal, Olusola O" <[email protected]> 
To 
 
"'[email protected]'" <[email protected]> 
Subject 
 
st: RE: Strmatch across rows 
Date 
 
Wed, 12 Feb 2014 14:47:36 +0000 
I'm having a problem with using strmatch across rows and columns. I am using Stata 13 for Windows. 
I have over 100,000 observations and 200 variables on acquisitions and their directors, but 10
observations and 5 variables will be enough to show the problem.
My data looks like this
         dir_id     year    SIC     TargetSIC        Acq
        --------------------------------------------------
          10043    2007    1111         .           0 
          10043    2007     .          1450         1
          10043    2008    1113         .           0
          10043    2009     .          1111         1
          10043    2010    1111         .           0        
          13944    2007    1112         .           0        
          13944    2008    1113         .            0
          13944    2009    5760         .           0
          13944    2008    1113         .           0
          13944    2009     .          5760         1
        ---------------------------------------------------
I am trying to calculate industry experience match (SIC) of the director (dir_id) which is the difference (in years) from a time when Acq = 1 to a time when Acq = 0 and strmatch =1.
The problem I have is that I don't know how to attach grab a specific year and make it a reference point for other years within the same dir_id.
I am fairly new to STATA, but I imagine a loop and a global variable would do the trick?
Any suggestions would be greatly appreciated!
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/