Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • needed wanted equal 1 if employeeexperience>2 and worked in his initial career for 2 consecutive years if CEOdummy==1 else 0

    Dear Stata Experts
    I need the Stata code to measure the “wanted” variable. I need a wanted variable which is a dummy variable to have a value equal to 1 if the “employeeexperience” is greater than 2, and if an employee having a personal ID (i.e., 1001, 1002, 1003 provided in column 3) has worked in his initial career for consecutive 2 years provided that the “CEOdummy” is 1 else 0. In simple words, I need a wanted variable equal to 1 if “employeeexperience” is more than 2 years, and if he has consecutive 2 years of experience in his initial career if the CEOdummy == 1 else 0. in orhter words, I need a dummy outcome variable equal to 1 if “employeeexperience”>2 and worked in his initial career for 2 consecutive years with a “CEOdummy” when “CEOdummy” was =1 else 0

    Please receive the data below;

    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(id year personalID CEOdummy employeeexperience wanted)
    4 2001 1002 1 1 .
    4 2001 1001 1 1 .
    4 2002 1001 0 2 .
    4 2002 1003 0 2 .
    4 2003 1003 0 3 0
    4 2003 1001 0 3 1
    4 2004 1001 1 4 1
    4 2004 1002 1 4 1
    8 2001 1001 0 1 .
    8 2001 1003 0 1 .
    8 2002 1001 1 2 .
    8 2002 1002 1 2 .
    8 2003 1001 0 3 1
    8 2003 1002 0 3 1
    8 2004 1003 1 4 0
    8 2004 1001 1 4 1

    end
Working...
X