Here is the program:
%macro vacnumeric (nprefix);
%do i = 1 %to &nprefix;
%let prefix1=%str(fur);
%let prefix2=%str(finearts);
%let prefix3=%str(jewel);
%let prefix4=%str(silver);
data newv66;
set newv55;
length &&prefix&i._pol_vac_tpremn 8.;
length &&prefix&i._blkt_amtn 8.;
length &&prefix&i._item_amtn 8.;
length &&prefix&i._nbr_item 8.;
length &&prefix&i._sub_class_tot_tpremn 8.;
&&prefix&i._pol_vac_tpremn = input(compress(&&prefix&i._pol_vac_tprem),8.);
&&prefix&i._blkt_amtn = input(compress(&&prefix&i._blkt_amt),8.);
&&prefix&i._item_amtn = input(compress(&&prefix&i._item_amt),8.);
&&prefix&i._nbr_itemn = input(compress(&&prefix&i._nbr_item),8.);
&&prefix&i._sub_class_tot_tpremn = input(compress(&&prefix&i._sub_class_tot_tpremn),8.);
run;
%end;
%mend vacnumeric;
%vacnumeric(4);
This is running incorrectly. For example for the first variable in the 1st run of the loop &&prefix&i._pol_vac_tpremn resolves to prefix1_pol_vac_tpremn. I wanted it to resolve to fur_pol_vac_tpremn. Additionally since this referencing isn't being resolved, I can't check if these twenty variable character to numeric changes will be in work.newv66 (or will the second 5 overwrite the first 5, third 5 overwrite the second 5, etc.) Can someone help me remedy this or offer a more efficient solution? Thanks.