I would probably recommend three arrays but you could do it with one. This highly depends on the order of the variables which isn't a good assumption in my book. Also, how would you name the results automatically?
data want;set have; array vars(*) stuff2016--fire2008; array diffs(*) diffs1-diffs20; *something big enough to hold difference;do i=1 to dim(vars)-1; diffs(i) = vars(i)-vars(i+1);end;run;
Instead, I'd highly suggest you use the dictionary tables to query your variable names and dynamically generate your variable lists which are then passed onto three different arrays, one for 2016, one for 2008 and one for the difference. The libname and memname are stored in uppercase in the Dictionary table so keep that in mind.
data have;input Stuff2016 Stuff2008 Earth2016 Earth2008 Fire2016 Fire2008;cards; 123456 5646743 45 456 456 890101 541351 543534534 45 489 489 74456 352352 564889 98 489489 1231 189 464646 542235423 13 15615 1561 78 987654 4561889 44 1212 12121 111 ;run;proc sql;select name into :var2016 separated by ""from sashelp.vcolumnwhere libname='WORK'and memname='HAVE'and name like '%2016'order by name;select name into :var2008 separated by ""from sashelp.vcolumnwhere libname='WORK'and memname='HAVE'and name like '%2008'order by name;select catx("_", compress(name, ,'d'), "diff") into :vardiff separated by ""from sashelp.vcolumnwhere libname='WORK'and memname='HAVE'and name like '%2016'order by name;quit;%put &var2016.;%put &var2008.;%put &vardiff.;data want;set have;array v2016(*) &var2016;array v2008(*) &var2008;array diffs(*) &vardiff;do i=1 to dim(v2016);diffs(i)=v2016(i)-v2008(i);end;run;