Bookmark and Share

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]

Re: st: RE: Strmatch across rows


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: RE: Strmatch across rows
Date   Wed, 12 Feb 2014 15:09:17 +0000

The sample data are most helpful, but your problem is fuzzily explained.

-strmatch()- is a function. You don't say exactly how you tried to use
it and why that didn't do what you wanted.

It's often best when learning Stata to set aside an initial guess at
how it might be solved and just explain in words what the rule is for
producing a new variable, with examples of what a new variable would
look like.

Nick
[email protected]

On 12 February 2014 14:47, Lawal, Olusola O <[email protected]> wrote:
> 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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index