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: calculating age / tenure


From   Rebecca Pope <[email protected]>
To   [email protected]
Subject   Re: st: calculating age / tenure
Date   Wed, 7 Nov 2012 17:06:51 -0600

So, if I understand your data & question, you've got something like
the following, right?

Data:
clear
input str3 company1 str3 company2 allyyear
abc def 1972
abc efg 1983
abc ghi 2001
def efg 1956
def abc 1972
def    xyz 1999
end

If so, just do this:
sort company1 allyyear
by company1: gen exper = allyyear - allyyear[1]

This gives you:
input str3 company1 str3 company2 allyyear
abc def 1972 0
abc efg 1983 11
abc ghi 2001 29
def efg 1956 0
def abc 1972 16
def    xyz 1999 43

Then you could just keep the 2nd observation per company1, which gives
you the first time they had any experience. Ditto 2.

Hope this helps.
Rebecca



         __o                __o
      _`\ <,_            _`\ <,_
     (_)/   (_)          (_)/   (_)
=========================


On Wed, Nov 7, 2012 at 4:29 PM, Ravindran, Kiron <[email protected]> wrote:
> I know there should be a simple way of doing this. But am tying myself
> up in knots figuring this out. Perhaps someone here can help
>
> I have a table that looks like this Company1, Company2, Year of alliance
>
> I want to calculate three different measures.
> 1. Company 1's experience: i.e. Year of Alliance of the Company1 minus
> the first Year of Alliance of company 1. (this captures the number of
> years of experience Company 1 has by being in any alliance)
>
> 2. The same for company 2
>
> 3. The alliance experience. The current year of alliance minus the
> year of alliance when this particular dyad of Company 1 and Company 2
> had their first alliance
>
> Thanks in advance
> *
> *   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