BookmarkSubscribeRSS Feed
Theo_Gh
Obsidian | Level 7

Hi,

 

Attached is data I'm working with. I want to decompose the tenure variable (the number of years beginning from the year when the ceo took office) into: 1. Early years: an indicator variable that equals 1 for firm-years that correspond to  the first 3 years of a ceo's tenure and 1 otherwise 2.Years_3_5: an indicator variable that equals 1 if tenure is between years 3 and 5 years and 0 otherwise and 3. Year_6_and _over: an indicator variable that equals 1 for tenures after 5 years, and 0 otherwise.

 

Thanks. 

4 REPLIES 4
Shmuel
Garnet | Level 18

Why do you want 3 variables if you can create one with 3 values?

There are several ways to do it:

 

1)  if tenur le 3 then flag=1; else

     if tenur le 5 then flag=2; else flag=3;

 

2) select (tenur);

       when (1,2,3) flag=1;

       when (4, 5)   flag=2;

       otherwise      flag=3;

    end;

 

3) creating a format:

      proc format lib=work;

             value fmt

            1-3 = '1'

            4-5 = '2'

          6-high = '3'

      ; run;

      data want;

         set have;  /* imported xlsx file */

               flag=put(tenur,fmt1.); /* using the format method or insert here any other preffered method from above */

      run;

Theo_Gh
Obsidian | Level 7

Thank you.

 

I would want to observe certain characteristics of a CEO over their tenure. Tenure starts in the fiscal year they take office and increases with each year the CEO stays in office. Eg. if the CEO's tenure was 10 years, I would want to study the decisions that CEO took in their first three years, their decisions between the third and fifth years, and the sixth year and above. In the same vein, if a CEO's tenure is 1 year for instance, then I can only study their decisions for that year only. I don't know if these codes takes my point into consideration.

 

Thank you.

Shmuel
Garnet | Level 18

I'm not an analyst but, with many sas procedures you can get results BY KEY.

In your case, the key - as much as I understand - is built of the 3 variables:

      Company_ID  PERSONID  and the calculated FLAG (or any other name you preffer)

while the FLAG represents the groups of the TENURE - as you defined.

 

For furthere help, if need to choose sas procedure, you will need sas analyst advise.

Theo_Gh
Obsidian | Level 7
Thanks

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1106 views
  • 0 likes
  • 2 in conversation