Here is an illustration. Extend it to your needs.
data _null_;
set have;
array v varA -- varB3;
do i = 1 to dim(v);
if substr(vname(v[i]),4,1) = 'A' then put v[i]=;
end;
run;
This writes to the log.
Another way is to catch the values of the selected values of variables into a space separated List as:
data want;
set have;
array v varA -- varB3;
length str $32767;
call missing(str);
do i = 1 to dim(v);
if substr(vname(v[i]),4,1) = 'A' then str = catx(' ',str, v[i]);
end;
keep company str;
run;
... View more