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!
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;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.