Announcement

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

  • calculating a variable that contain start and end dates

    Hi, I need to calculate the Sustainability Committee variable, which is a dummy variable indicating whether a firm had a specialized board committee on sustainability-related issues in a given year (coded as 1).


    I have data on the number of directors serving on committees within a firm. For each director, I have start and end dates of their service on the committee. If at least one of these directors was present during a given year , then the firm is considered to have a sustainability committee for that year (coded as 1).other wise 0 My approach:

    1. Create a panel dataset for each firm (ticker) covering the years 2004–2022.
    2. For each year in this period, check if any director served on a sustainability-related committee during that year (i.e., their start date ≤ year ≤ end date).
    3. If at least one director was present, code Sustainability Committee = 1 for that firm-year; otherwise, code it as 0.
    4. IM NOT SURE HOW CAN I CODE THIS IN STATA . CAN YOU HELP ME PLEASE
    Im not sure how can i do this in STATA . can anyone help me please
    Click image for larger version

Name:	pictucre.png
Views:	1
Size:	640.5 KB
ID:	1774548

  • #2
    Having posted here 132 times, I would think you would by now know that when you need help with code you should show example data, and that showing example data with a screenshot is not helpful.

    Please post back using the -dataex- command to show your example data. Also, from your description it sounds to me as if you actually have two files to work with: one is the file of directors who have served on sustainability committees, and the other is a file of firms with all of their directors. Example data from both is required to develop code that will actually work.

    If you are running version 18, 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    Comment


    • #3
      thanks Clyde for advice

      Comment


      • #4
        Please follow new thread https://www.statalist.org/forums/for...A0-and-enddate if interested

        Comment

        Working...
        X