BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sfan6
Calcite | Level 5

Hello everyone, I am writing research project and I have the data set,

 

Year       company_ID           Board_Director_ID           Financial_Expert          Independent_Board 

2007          001                               AAA                          Yes                                    No

2007          001                               BBB                          No                                    Yes

2007          001                              CCC                          No                                     No

2007          001                              DDD                          No                                     No

2008          002                              EEE                           No                                     No 

2008          002                              FFF                           Yes                                    No 

2008          002                             GGG                          No                                     No 

2009          001                             AAA                            Yes                                    No

2009          001                             BBB                            No                                    Yes

2009          001                            CCC                            No                                     No

2009          001                             DDD                           No                                     No

 

I need to transform into firm-year obs, and the expected result would be

Year       company_ID        Financial_Expert          Independent_Board 

2007             001                      1(Yes)                                   1 (Yes)

2008             002                      1                                           0

2009             001                       1                                           1

 

I very appreciate your help!

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20
data have;
input Year (company_ID Board_Director_ID  Financial_Expert          Independent_Board ) (:$10.);
cards;
2007          001                               AAA                          Yes                                    No
2007          001                               BBB                          No                                    Yes
2007          001                              CCC                          No                                     No
2007          001                              DDD                          No                                     No
2008          002                              EEE                           No                                     No 
2008          002                              FFF                           Yes                                    No 
2008          002                             GGG                          No                                     No 
2009          001                             AAA                            Yes                                    No
2009          001                             BBB                            No                                    Yes
2009          001                            CCC                            No                                     No
2009          001                             DDD                           No                                     No
;

proc sql;
create table want as
select year,company_ID,max(Financial_Expert="Yes") as Financial_Expert,max(Independent_Board="Yes") as Independent_Board
from have
group by Year,company_ID;
quit;

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20
data have;
input Year (company_ID Board_Director_ID  Financial_Expert          Independent_Board ) (:$10.);
cards;
2007          001                               AAA                          Yes                                    No
2007          001                               BBB                          No                                    Yes
2007          001                              CCC                          No                                     No
2007          001                              DDD                          No                                     No
2008          002                              EEE                           No                                     No 
2008          002                              FFF                           Yes                                    No 
2008          002                             GGG                          No                                     No 
2009          001                             AAA                            Yes                                    No
2009          001                             BBB                            No                                    Yes
2009          001                            CCC                            No                                     No
2009          001                             DDD                           No                                     No
;

proc sql;
create table want as
select year,company_ID,max(Financial_Expert="Yes") as Financial_Expert,max(Independent_Board="Yes") as Independent_Board
from have
group by Year,company_ID;
quit;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 386 views
  • 2 likes
  • 2 in conversation