Hi R_Win,
the following code queries sashelp.vcolumn to get the variable names and call execute to create a proc datasets with the rename statment for all variables.
[pre]
data _null_;
set sashelp.vcolumn(
keep= Name LibName MemName
rename= (Name = OldName)
where= (Libname='WORK' and MemName = 'A')
) end= last;
length NewName $ 32;
if _n_ = 1 then do;
call execute('proc datasets library=work nolist;');
call execute('modify a;');
call execute('rename ');
end;
NewName = compress(OldName, ' ');
OldName = cats("'", OldName, "'n");
call execute(trim(OldName) !! ' = ' !! trim(NewName));
if last then do;
call execute(';');
call execute('run;');
end;
run;[/pre]
... View more