%let start_date = 01jan2012; %let end_date = 01aug2013; %let months = intck('month',"&start_date."d,"&end_date."d); data dates (drop= m date); do m = 0 to &months.; date = intnx('month',"&start_date."d,m,'s'); Month=month(date); Year=year(date); output; end; run; data have ; input Year Month Premium; cards; 2012 3 2012 6 5500 2012 12 5250 2013 3 5400 2013 6 5000 2013 9 5100 ; run; proc sql ; create table want as select a.year, a.month, b.premium from work.dates a LEFT JOIN work.have b on (a.year = b.year AND a.month = b.month) ;run; data want ; if _n_=1 then do; do until(premium); set want; if not missing(premium) then want_value=premium; end; end; do until(last); set want end=last; if premium then want_value= premium; output; end; run;
... View more