Hi Xia Keshan, (Or anyone else reading this!) I have a very similar question with one caveat -- each cross-sectional regression needs a minimum of 20 observations beginning at the 2-digit SIC level. For 2-digit industry groups with less than 20 observations, I need to form industry groups at the 1-digit SIC level. Can this be accomplished directly in the proc reg statement or does it need to be separately identified? My thoughts are to create a table as such: proc sql; create table mywork.comp_yi2 as select fyear, sich substrn(sich,1,2) as sich_two, (count(*) GE 20) as has_twenty from mywork.compf group by fyear, substrn(SIC,1,2) having (has_twenty=1); quit; And then running a pair of proc reg statements e.g. For 2-digit groups having 20 observations: proc reg noprint data=&in_ds outest=oreg_ds1 edf; where substrn(SIC,1,2) in mywork.comp_yi2 model IV=DVs; by fyear; substrn(SIC,1,2) run; For The 1 digit SIC level: proc reg noprint data=&in_ds outest=oreg_ds2 edf; where not substrn(SIC,1,2) in mywork.comp_yi2 model IV=DVs; by fyear; substrn(SIC,1,1) run; And then mashing the two together: proc datasets lib=work; append base=oreg_ds1 data=oreg_ds2; run; Also -- will having the by clause mean the outtest data sets will aggregate all the cross sectional regressions, or do I need to write an iterative macro to accomplish this? Best, Prometheus
... View more