Dear Community Members, I have been trying to make the program below run, but so far I have failed. I have a dataset with multiple periods, and for each period, I want to run a bunch of models. The loops keep getting stock at per=1 (it won't go to the next one), and it will also give an error saying that model1 (and others) cannot be found. I attached a sample of my dataset (2 periods and 2 models). In the full version, I have 5 periods and 24 models, and I would have to manually run this program 120 times. I would really appreciate your help with this issue. %macro twostep; %do per=1 %to 2; %do m=1 %to 2; %let model1= vret_msa mktrf100; *model specification; %let model2= vret_msa mktrf100 ind_ret; data perret&per; set 14_samplesas; if period=&per; proc sort data=perret&per; by permno myear; run; /*Regressions*/ ods listing close; ods output parameterestimates=pe&per&m; proc reg data=perret&per; by permno; model ereturn_i =model&m; run; quit; ods listing; ods rtf file="C:\SAS\results\period&per model&m.rtf" style=journal; proc means data=pe&per&m mean std t probt; var estimate; class variable; run; *By variable by variable, it calculates the mean, standard deviation, t-statistics and p-value of the coefficient estimates; proc sort data=pe&per&m; by variable; run; ods rtf close; %end; %end; %mend; %twostep;
... View more