Hi all, would appreciate some help with this problem. I'm trying to find out the number of firm-years for the entire sample according to three categories: buy firm-year, sell firm-year, and mixed firm-year. The firm-years are categorized based on the second column. If a firm-year only has BUY, it'll be a buy firm-year. If a firm-year has both BUYs and SELLs, it'll be a mixed-firm year. For example Firm A would have a total of 5 firm-years comprising of 4 sell firm-years and 1 mixed firm-year. I used this code below to obtain the total firm-years but I'm having difficulty breaking them down into the categories. proc sql; create table TABLE as select *,count(distinct year) as firmyear from DATA group by FIRM; quit; Is there a SAS equivalent of Excel's countif function where I can set multiple conditions? Example of the sample: Firm Trade Year firmyear buyyear sellyear mixedyear Firm A SELL 2008 5 0 4 1 Firm A SELL 2009 5 0 4 1 Firm A SELL 2010 5 0 4 1 Firm A SELL 2011 5 0 4 1 Firm A BUY 2012 5 0 4 1 Firm A SELL 2012 5 0 4 1 Firm A BUY 2012 5 0 4 1 Firm A SELL 2012 5 0 4 1 Firm A SELL 2012 5 0 4 1 Firm A BUY 2012 5 0 4 1 Firm A BUY 2012 5 0 4 1 Firm A BUY 2012 5 0 4 1 Firm A SELL 2012 5 0 4 1 Firm B BUY 2012 2 1 0 1 Firm B BUY 2012 2 1 0 1 Firm B SELL 2012 2 1 0 1 Firm B BUY 2013 2 1 0 1 Firm B BUY 2013 2 1 0 1
... View more