This will work for the full solution.
proc sql;
create table temp2
(
acaedemic_period_base varchar(6),
year1 num(1),
year2 num(1)
);
quit;
proc sql;
insert into temp2(acaedemic_period_base, Year1, Year2) values ('200810', 1, 1);
insert into temp2(acaedemic_period_base, Year1, Year2) values ('200710', 1, 1);
insert into temp2(acaedemic_period_base, Year1, Year2) values ('200810', 0, 0);
insert into temp2(acaedemic_period_base, Year1, Year2) values ('200710', 1, 0);
insert into temp2(acaedemic_period_base, Year1, Year2) values ('200810', 1, 1);
insert into temp2(acaedemic_period_base, Year1, Year2) values ('200710', 1, 1);
quit;
data want;
set temp2;
base_year=input(acaedemic_period_base,4.)-1;
array fall [2007:2010] Fall_2007-Fall_2010;
fall[base_year+1]=year1;
fall[base_year+2]=year2;
if Fall_2007 = . then Fall_2008 =0;
if Fall_2008 = . then Fall_2008 =0;
if Fall_2009 = . then Fall_2009 =0;
if Fall_2010 = . then Fall_2010 =0;
run;
... View more