Hi, One way could be to rearrange your data from wide-to-long, thus having one rate column and a date column. Then you can use either proc sql or proc summary/means to summarize the rate (column) using a where statement that uses your macro variables, something like this: data long; set your_wide_data; rate = rate_03_2010; date = mdy(03,01,2010);*I chose the day to be the first (01) since it doesn't seem to matter for your problem; output; rate = rate_04_2010; date = mdy(06,01,2010); output; ... rate = rate_06_2012; date = mdy(06,01,2012); output; proc means data = long; var rate; where mdy(&StartDateMonth., 01, &StartDateYear. ) <= date <= mdy(&EndDateMonth.,01, &endDateYear.); run; or proc sql noprint; create table averages_&StartDateMonth as select avg(rate) as average_rate from long where mdy(&StartDateMonth., 01, &StartDateYear. ) <= date <= mdy(&EndDateMonth.,01, &endDateYear.); quit; Best of luck, Anca.
... View more