Ok. See if you can use this as a template. Since I don't have your data, I use SASHELP.STOCKS to create some example data. I create it so IBM, Microsoft are traded more than Intel.
data have;
set sashelp.stocks;
if stock in ('IBM', 'Microsoft') then do;
output; output;
end;
else output;
run;
proc freq data = have;
tables stock / nocum nopercent;
run;
So in this example, I want at least 250 obs for a stock to include in the first data set (change this to 30)
proc sql;
create table one as
select * from have
group by stock
having n(stock) > 250;
quit;
Next, I use this to create averages for each date.
proc summary data = one nway;
class date;
var close;
output out = want(drop = _:) mean =;
run;
Hope this helps 🙂
... View more